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 #include "content/browser/renderer_host/render_message_filter.h" | 5 #include "content/browser/renderer_host/render_message_filter.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 namespace { | 94 namespace { |
95 | 95 |
96 #if defined(ENABLE_PLUGINS) | 96 #if defined(ENABLE_PLUGINS) |
97 const int kPluginsRefreshThresholdInSeconds = 3; | 97 const int kPluginsRefreshThresholdInSeconds = 3; |
98 #endif | 98 #endif |
99 | 99 |
100 // When two CPU usage queries arrive within this interval, we sample the CPU | 100 // When two CPU usage queries arrive within this interval, we sample the CPU |
101 // usage only once and send it as a response for both queries. | 101 // usage only once and send it as a response for both queries. |
102 static const int64 kCPUUsageSampleIntervalMs = 900; | 102 static const int64 kCPUUsageSampleIntervalMs = 900; |
103 | 103 |
104 const uint32 kFilteredMessageClasses[] = { | |
105 ChildProcessMsgStart, | |
106 DesktopNotificationMsgStart, | |
107 FrameMsgStart, | |
108 ViewMsgStart, | |
109 }; | |
110 | |
111 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
112 // On Windows, |g_color_profile| can run on an arbitrary background thread. | 105 // On Windows, |g_color_profile| can run on an arbitrary background thread. |
113 // We avoid races by using LazyInstance's constructor lock to initialize the | 106 // We avoid races by using LazyInstance's constructor lock to initialize the |
114 // object. | 107 // object. |
115 base::LazyInstance<gfx::ColorProfile>::Leaky g_color_profile = | 108 base::LazyInstance<gfx::ColorProfile>::Leaky g_color_profile = |
116 LAZY_INSTANCE_INITIALIZER; | 109 LAZY_INSTANCE_INITIALIZER; |
117 #endif | 110 #endif |
118 | 111 |
119 // Common functionality for converting a sync renderer message to a callback | 112 // Common functionality for converting a sync renderer message to a callback |
120 // function in the browser. Derive from this, create it on the heap when | 113 // function in the browser. Derive from this, create it on the heap when |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 RenderMessageFilter::RenderMessageFilter( | 313 RenderMessageFilter::RenderMessageFilter( |
321 int render_process_id, | 314 int render_process_id, |
322 bool is_guest, | 315 bool is_guest, |
323 PluginServiceImpl* plugin_service, | 316 PluginServiceImpl* plugin_service, |
324 BrowserContext* browser_context, | 317 BrowserContext* browser_context, |
325 net::URLRequestContextGetter* request_context, | 318 net::URLRequestContextGetter* request_context, |
326 RenderWidgetHelper* render_widget_helper, | 319 RenderWidgetHelper* render_widget_helper, |
327 media::AudioManager* audio_manager, | 320 media::AudioManager* audio_manager, |
328 MediaInternals* media_internals, | 321 MediaInternals* media_internals, |
329 DOMStorageContextWrapper* dom_storage_context) | 322 DOMStorageContextWrapper* dom_storage_context) |
330 : BrowserMessageFilter( | 323 : resource_dispatcher_host_(ResourceDispatcherHostImpl::Get()), |
331 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), | |
332 resource_dispatcher_host_(ResourceDispatcherHostImpl::Get()), | |
333 plugin_service_(plugin_service), | 324 plugin_service_(plugin_service), |
334 profile_data_directory_(browser_context->GetPath()), | 325 profile_data_directory_(browser_context->GetPath()), |
335 request_context_(request_context), | 326 request_context_(request_context), |
336 resource_context_(browser_context->GetResourceContext()), | 327 resource_context_(browser_context->GetResourceContext()), |
337 render_widget_helper_(render_widget_helper), | 328 render_widget_helper_(render_widget_helper), |
338 incognito_(browser_context->IsOffTheRecord()), | 329 incognito_(browser_context->IsOffTheRecord()), |
339 dom_storage_context_(dom_storage_context), | 330 dom_storage_context_(dom_storage_context), |
340 render_process_id_(render_process_id), | 331 render_process_id_(render_process_id), |
341 is_guest_(is_guest), | 332 is_guest_(is_guest), |
342 cpu_usage_(0), | 333 cpu_usage_(0), |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 } | 1258 } |
1268 | 1259 |
1269 // Fallback to fake GpuMemoryBuffer that is backed by shared memory and | 1260 // Fallback to fake GpuMemoryBuffer that is backed by shared memory and |
1270 // requires an upload before it can be used as a texture. | 1261 // requires an upload before it can be used as a texture. |
1271 handle->type = gfx::SHARED_MEMORY_BUFFER; | 1262 handle->type = gfx::SHARED_MEMORY_BUFFER; |
1272 ChildProcessHostImpl::AllocateSharedMemory( | 1263 ChildProcessHostImpl::AllocateSharedMemory( |
1273 static_cast<size_t>(buffer_size), PeerHandle(), &handle->handle); | 1264 static_cast<size_t>(buffer_size), PeerHandle(), &handle->handle); |
1274 } | 1265 } |
1275 | 1266 |
1276 } // namespace content | 1267 } // namespace content |
OLD | NEW |