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 CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 WebGraphicsContext3DCommandBufferImpl* GetGpuVDAContext3D(); | 231 WebGraphicsContext3DCommandBufferImpl* GetGpuVDAContext3D(); |
232 | 232 |
233 // Handle loss of the shared GpuVDAContext3D context above. | 233 // Handle loss of the shared GpuVDAContext3D context above. |
234 static void OnGpuVDAContextLoss(); | 234 static void OnGpuVDAContextLoss(); |
235 | 235 |
236 // AudioRendererMixerManager instance which manages renderer side mixer | 236 // AudioRendererMixerManager instance which manages renderer side mixer |
237 // instances shared based on configured audio parameters. Lazily created on | 237 // instances shared based on configured audio parameters. Lazily created on |
238 // first call. | 238 // first call. |
239 content::AudioRendererMixerManager* GetAudioRendererMixerManager(); | 239 content::AudioRendererMixerManager* GetAudioRendererMixerManager(); |
240 | 240 |
| 241 // For producing custom V8 histograms. Custom histograms are produced if all |
| 242 // RenderViews share the same host, and the host is in the pre-specified set |
| 243 // of hosts we want to produce custom diagrams for. The name for a custom |
| 244 // diagram is the name of the corresponding generic diagram plus a |
| 245 // host-specific suffix. |
| 246 class CONTENT_EXPORT HistogramCustomizer { |
| 247 public: |
| 248 HistogramCustomizer(); |
| 249 ~HistogramCustomizer(); |
| 250 |
| 251 // Called when a top frame of a RenderView navigates. This function updates |
| 252 // RenderThreadImpl's information about whether all RenderViews are |
| 253 // displaying a page from the same host. |host| is the host where a |
| 254 // RenderView navigated, and |view_count| is the number of RenderViews in |
| 255 // this process. |
| 256 void RenderViewNavigatedToHost(const std::string& host, size_t view_count); |
| 257 |
| 258 // Used for customizing some histograms if all RenderViews share the same |
| 259 // host. Returns the current custom histogram name to use for |
| 260 // |histogram_name|, or |histogram_name| if it shouldn't be customized. |
| 261 std::string ConvertToCustomHistogramName(const char* histogram_name) const; |
| 262 |
| 263 private: |
| 264 friend class RenderThreadImplUnittest; |
| 265 |
| 266 // Used for updating the information on which is the common host which all |
| 267 // RenderView's share (if any). If there is no common host, this function is |
| 268 // called with an empty string. |
| 269 void SetCommonHost(const std::string& host); |
| 270 |
| 271 // The current common host of the RenderViews; empty string if there is no |
| 272 // common host. |
| 273 std::string common_host_; |
| 274 // The corresponding suffix. |
| 275 std::string common_host_histogram_suffix_; |
| 276 // Set of histograms for which we want to produce a custom histogram if |
| 277 // possible. |
| 278 std::set<std::string> custom_histograms_; |
| 279 |
| 280 DISALLOW_COPY_AND_ASSIGN(HistogramCustomizer); |
| 281 }; |
| 282 |
| 283 HistogramCustomizer* histogram_customizer() { |
| 284 return &histogram_customizer_; |
| 285 } |
| 286 |
241 private: | 287 private: |
242 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; | 288 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; |
243 | 289 |
244 void Init(); | 290 void Init(); |
245 | 291 |
246 void OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level); | 292 void OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level); |
247 void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors); | 293 void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors); |
248 void OnCreateNewView(const ViewMsg_New_Params& params); | 294 void OnCreateNewView(const ViewMsg_New_Params& params); |
249 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 295 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
250 void OnPurgePluginListCache(bool reload_pages); | 296 void OnPurgePluginListCache(bool reload_pages); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 scoped_ptr<content::old::BrowserPluginRegistry> browser_plugin_registry_; | 357 scoped_ptr<content::old::BrowserPluginRegistry> browser_plugin_registry_; |
312 | 358 |
313 ObserverList<content::RenderProcessObserver> observers_; | 359 ObserverList<content::RenderProcessObserver> observers_; |
314 | 360 |
315 class GpuVDAContextLostCallback; | 361 class GpuVDAContextLostCallback; |
316 scoped_ptr<GpuVDAContextLostCallback> context_lost_cb_; | 362 scoped_ptr<GpuVDAContextLostCallback> context_lost_cb_; |
317 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> gpu_vda_context3d_; | 363 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> gpu_vda_context3d_; |
318 | 364 |
319 scoped_ptr<content::AudioRendererMixerManager> audio_renderer_mixer_manager_; | 365 scoped_ptr<content::AudioRendererMixerManager> audio_renderer_mixer_manager_; |
320 | 366 |
| 367 HistogramCustomizer histogram_customizer_; |
| 368 |
321 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 369 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
322 }; | 370 }; |
323 | 371 |
324 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 372 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |