OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_PLATFORM_SUPPORT_IMPL_H_ | 5 #ifndef WEBKIT_PLATFORM_SUPPORT_IMPL_H_ |
6 #define WEBKIT_PLATFORM_SUPPORT_IMPL_H_ | 6 #define WEBKIT_PLATFORM_SUPPORT_IMPL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "third_party/WebKit/public/platform/Platform.h" | 12 #include "third_party/WebKit/public/platform/Platform.h" |
13 #include "third_party/WebKit/public/platform/WebURLError.h" | 13 #include "third_party/WebKit/public/platform/WebURLError.h" |
14 #include "ui/base/layout.h" | 14 #include "ui/base/layout.h" |
15 #include "webkit/glue/resource_loader_bridge.h" | 15 #include "webkit/glue/resource_loader_bridge.h" |
16 #include "webkit/glue/webkit_glue_export.h" | 16 #include "webkit/glue/webkit_glue_export.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class MessageLoop; | 19 class MessageLoop; |
20 } | 20 } |
21 | 21 |
22 namespace webkit { | |
23 struct WebPluginInfo; | |
24 } | |
25 | |
26 namespace WebKit { | 22 namespace WebKit { |
27 class WebSocketStreamHandle; | 23 class WebSocketStreamHandle; |
28 } | 24 } |
29 | 25 |
30 namespace webkit_glue { | 26 namespace webkit_glue { |
31 | 27 |
32 class WebSocketStreamHandleDelegate; | 28 class WebSocketStreamHandleDelegate; |
33 class WebSocketStreamHandleBridge; | 29 class WebSocketStreamHandleBridge; |
34 | 30 |
35 class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : | 31 class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl : |
(...skipping 17 matching lines...) Expand all Loading... |
53 const WebKit::WebURL& url); | 49 const WebKit::WebURL& url); |
54 virtual size_t memoryUsageMB(); | 50 virtual size_t memoryUsageMB(); |
55 virtual size_t actualMemoryUsageMB(); | 51 virtual size_t actualMemoryUsageMB(); |
56 #if defined(OS_ANDROID) // Other OSes just use the default values. | 52 #if defined(OS_ANDROID) // Other OSes just use the default values. |
57 // TODO(jochen): Remove these. | 53 // TODO(jochen): Remove these. |
58 virtual size_t lowMemoryUsageMB(); | 54 virtual size_t lowMemoryUsageMB(); |
59 virtual size_t highMemoryUsageMB(); | 55 virtual size_t highMemoryUsageMB(); |
60 virtual size_t highUsageDeltaMB(); | 56 virtual size_t highUsageDeltaMB(); |
61 #endif | 57 #endif |
62 | 58 |
63 virtual void startHeapProfiling(const WebKit::WebString& /*prefix*/) OVERRIDE; | 59 virtual void startHeapProfiling(const WebKit::WebString& prefix); |
64 virtual void stopHeapProfiling() OVERRIDE; | 60 virtual void stopHeapProfiling() OVERRIDE; |
65 virtual void dumpHeapProfiling(const WebKit::WebString& /*reason*/) OVERRIDE; | 61 virtual void dumpHeapProfiling(const WebKit::WebString& reason); |
66 virtual WebKit::WebString getHeapProfile() OVERRIDE; | 62 virtual WebKit::WebString getHeapProfile() OVERRIDE; |
67 | 63 |
68 virtual bool processMemorySizesInBytes(size_t* private_bytes, | 64 virtual bool processMemorySizesInBytes(size_t* private_bytes, |
69 size_t* shared_bytes); | 65 size_t* shared_bytes); |
70 virtual bool memoryAllocatorWasteInBytes(size_t* size); | 66 virtual bool memoryAllocatorWasteInBytes(size_t* size); |
71 virtual WebKit::WebURLLoader* createURLLoader(); | 67 virtual WebKit::WebURLLoader* createURLLoader(); |
72 virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle(); | 68 virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle(); |
73 virtual WebKit::WebString userAgent(const WebKit::WebURL& url); | 69 virtual WebKit::WebString userAgent(const WebKit::WebURL& url); |
74 virtual WebKit::WebData parseDataURL( | 70 virtual WebKit::WebData parseDataURL( |
75 const WebKit::WebURL& url, WebKit::WebString& mimetype, | 71 const WebKit::WebURL& url, WebKit::WebString& mimetype, |
76 WebKit::WebString& charset); | 72 WebKit::WebString& charset); |
77 virtual WebKit::WebURLError cancelledError(const WebKit::WebURL& url) const; | 73 virtual WebKit::WebURLError cancelledError(const WebKit::WebURL& url) const; |
78 virtual void getPluginList(bool refresh, WebKit::WebPluginListBuilder*); | |
79 virtual void decrementStatsCounter(const char* name); | 74 virtual void decrementStatsCounter(const char* name); |
80 virtual void incrementStatsCounter(const char* name); | 75 virtual void incrementStatsCounter(const char* name); |
81 virtual void histogramCustomCounts( | 76 virtual void histogramCustomCounts( |
82 const char* name, int sample, int min, int max, int bucket_count); | 77 const char* name, int sample, int min, int max, int bucket_count); |
83 virtual void histogramEnumeration( | 78 virtual void histogramEnumeration( |
84 const char* name, int sample, int boundary_value); | 79 const char* name, int sample, int boundary_value); |
85 virtual const unsigned char* getTraceCategoryEnabledFlag( | 80 virtual const unsigned char* getTraceCategoryEnabledFlag( |
86 const char* category_name); | 81 const char* category_name); |
87 virtual long* getTraceSamplingState(const unsigned thread_bucket); | 82 virtual long* getTraceSamplingState(const unsigned thread_bucket); |
88 virtual void addTraceEvent( | 83 virtual void addTraceEvent( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 116 |
122 // Gets a localized string given a message id. Returns an empty string if the | 117 // Gets a localized string given a message id. Returns an empty string if the |
123 // message id is not found. | 118 // message id is not found. |
124 virtual base::string16 GetLocalizedString(int message_id) = 0; | 119 virtual base::string16 GetLocalizedString(int message_id) = 0; |
125 | 120 |
126 // Returns the raw data for a resource. This resource must have been | 121 // Returns the raw data for a resource. This resource must have been |
127 // specified as BINDATA in the relevant .rc file. | 122 // specified as BINDATA in the relevant .rc file. |
128 virtual base::StringPiece GetDataResource(int resource_id, | 123 virtual base::StringPiece GetDataResource(int resource_id, |
129 ui::ScaleFactor scale_factor) = 0; | 124 ui::ScaleFactor scale_factor) = 0; |
130 | 125 |
131 // Returns the list of plugins. | |
132 virtual void GetPlugins(bool refresh, | |
133 std::vector<webkit::WebPluginInfo>* plugins) = 0; | |
134 // Creates a ResourceLoaderBridge. | 126 // Creates a ResourceLoaderBridge. |
135 virtual ResourceLoaderBridge* CreateResourceLoader( | 127 virtual ResourceLoaderBridge* CreateResourceLoader( |
136 const ResourceLoaderBridge::RequestInfo& request_info) = 0; | 128 const ResourceLoaderBridge::RequestInfo& request_info) = 0; |
137 // Creates a WebSocketStreamHandleBridge. | 129 // Creates a WebSocketStreamHandleBridge. |
138 virtual WebSocketStreamHandleBridge* CreateWebSocketBridge( | 130 virtual WebSocketStreamHandleBridge* CreateWebSocketBridge( |
139 WebKit::WebSocketStreamHandle* handle, | 131 WebKit::WebSocketStreamHandle* handle, |
140 WebSocketStreamHandleDelegate* delegate) = 0; | 132 WebSocketStreamHandleDelegate* delegate) = 0; |
141 | 133 |
142 void SuspendSharedTimer(); | 134 void SuspendSharedTimer(); |
143 void ResumeSharedTimer(); | 135 void ResumeSharedTimer(); |
144 virtual void OnStartSharedTimer(base::TimeDelta delay) {} | 136 virtual void OnStartSharedTimer(base::TimeDelta delay) {} |
145 | 137 |
146 private: | 138 private: |
147 void DoTimeout() { | 139 void DoTimeout() { |
148 if (shared_timer_func_ && !shared_timer_suspended_) | 140 if (shared_timer_func_ && !shared_timer_suspended_) |
149 shared_timer_func_(); | 141 shared_timer_func_(); |
150 } | 142 } |
151 | 143 |
152 base::MessageLoop* main_loop_; | 144 base::MessageLoop* main_loop_; |
153 base::OneShotTimer<WebKitPlatformSupportImpl> shared_timer_; | 145 base::OneShotTimer<WebKitPlatformSupportImpl> shared_timer_; |
154 void (*shared_timer_func_)(); | 146 void (*shared_timer_func_)(); |
155 double shared_timer_fire_time_; | 147 double shared_timer_fire_time_; |
156 bool shared_timer_fire_time_was_set_while_suspended_; | 148 bool shared_timer_fire_time_was_set_while_suspended_; |
157 int shared_timer_suspended_; // counter | 149 int shared_timer_suspended_; // counter |
158 }; | 150 }; |
159 | 151 |
160 } // namespace webkit_glue | 152 } // namespace webkit_glue |
161 | 153 |
162 #endif // WEBKIT_PLATFORM_SUPPORT_IMPL_H_ | 154 #endif // WEBKIT_PLATFORM_SUPPORT_IMPL_H_ |
OLD | NEW |