Page Speed Optimization Libraries
1.6.29.3
|
00001 /* 00002 * Copyright 2013 Google Inc. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http:///www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00023 00024 #ifndef NET_INSTAWEB_UTIL_PUBLIC_FALLBACK_PROPERTY_PAGE_H_ 00025 #define NET_INSTAWEB_UTIL_PUBLIC_FALLBACK_PROPERTY_PAGE_H_ 00026 00027 #include "net/instaweb/util/public/basictypes.h" 00028 #include "net/instaweb/util/public/scoped_ptr.h" 00029 #include "net/instaweb/util/public/cache_interface.h" 00030 #include "net/instaweb/util/public/property_cache.h" 00031 #include "net/instaweb/util/public/string.h" 00032 #include "net/instaweb/util/public/string_util.h" 00033 00034 namespace net_instaweb { 00035 00036 class FallbackPropertyPage : public AbstractPropertyPage { 00037 public: 00039 FallbackPropertyPage(PropertyPage* actual_property_page, 00040 PropertyPage* property_page_with_fallback_values); 00041 virtual ~FallbackPropertyPage(); 00042 00045 virtual PropertyValue* GetProperty( 00046 const PropertyCache::Cohort* cohort, 00047 const StringPiece& property_name); 00048 00051 PropertyValue* GetFallbackProperty( 00052 const PropertyCache::Cohort* cohort, 00053 const StringPiece& property_name); 00054 00057 virtual void UpdateValue( 00058 const PropertyCache::Cohort* cohort, const StringPiece& property_name, 00059 const StringPiece& value); 00060 00063 virtual void WriteCohort(const PropertyCache::Cohort* cohort); 00064 00066 virtual CacheInterface::KeyState GetCacheState( 00067 const PropertyCache::Cohort* cohort); 00068 00070 virtual CacheInterface::KeyState GetFallbackCacheState( 00071 const PropertyCache::Cohort* cohort); 00072 00074 virtual void DeleteProperty(const PropertyCache::Cohort* cohort, 00075 const StringPiece& property_name); 00076 00077 virtual const GoogleString& key() const; 00078 00079 PropertyPage* actual_property_page() { return actual_property_page_.get(); } 00080 PropertyPage* property_page_with_fallback_values() { 00081 return property_page_with_fallback_values_.get(); 00082 } 00083 00084 private: 00085 scoped_ptr<PropertyPage> actual_property_page_; 00086 scoped_ptr<PropertyPage> property_page_with_fallback_values_; 00087 DISALLOW_COPY_AND_ASSIGN(FallbackPropertyPage); 00088 }; 00089 00090 } 00091 #endif ///< NET_INSTAWEB_UTIL_PUBLIC_FALLBACK_PROPERTY_PAGE_H_