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 "chrome/browser/renderer_host/chrome_render_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message) { | 58 bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message) { |
59 bool handled = true; | 59 bool handled = true; |
60 IPC_BEGIN_MESSAGE_MAP(ChromeRenderMessageFilter, message) | 60 IPC_BEGIN_MESSAGE_MAP(ChromeRenderMessageFilter, message) |
61 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DnsPrefetch, OnDnsPrefetch) | 61 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DnsPrefetch, OnDnsPrefetch) |
62 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Preconnect, OnPreconnect) | 62 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_Preconnect, OnPreconnect) |
63 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ResourceTypeStats, | 63 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ResourceTypeStats, |
64 OnResourceTypeStats) | 64 OnResourceTypeStats) |
65 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdatedCacheStats, | 65 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdatedCacheStats, |
66 OnUpdatedCacheStats) | 66 OnUpdatedCacheStats) |
67 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FPS, OnFPS) | |
68 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_V8HeapStats, OnV8HeapStats) | 67 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_V8HeapStats, OnV8HeapStats) |
69 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDatabase, OnAllowDatabase) | 68 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDatabase, OnAllowDatabase) |
70 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDOMStorage, OnAllowDOMStorage) | 69 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowDOMStorage, OnAllowDOMStorage) |
71 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessSync, | 70 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessSync, |
72 OnRequestFileSystemAccessSync) | 71 OnRequestFileSystemAccessSync) |
73 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessAsync, | 72 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestFileSystemAccessAsync, |
74 OnRequestFileSystemAccessAsync) | 73 OnRequestFileSystemAccessAsync) |
75 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) | 74 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
76 #if defined(ENABLE_PLUGINS) | 75 #if defined(ENABLE_PLUGINS) |
77 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsCrashReportingEnabled, | 76 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsCrashReportingEnabled, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 TaskManager::GetInstance()->model()->NotifyResourceTypeStats(peer_pid(), | 124 TaskManager::GetInstance()->model()->NotifyResourceTypeStats(peer_pid(), |
126 stats); | 125 stats); |
127 #endif // defined(ENABLE_TASK_MANAGER) | 126 #endif // defined(ENABLE_TASK_MANAGER) |
128 } | 127 } |
129 | 128 |
130 void ChromeRenderMessageFilter::OnUpdatedCacheStats( | 129 void ChromeRenderMessageFilter::OnUpdatedCacheStats( |
131 const WebCache::UsageStats& stats) { | 130 const WebCache::UsageStats& stats) { |
132 WebCacheManager::GetInstance()->ObserveStats(render_process_id_, stats); | 131 WebCacheManager::GetInstance()->ObserveStats(render_process_id_, stats); |
133 } | 132 } |
134 | 133 |
135 void ChromeRenderMessageFilter::OnFPS(int routing_id, float fps) { | |
136 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | |
137 BrowserThread::PostTask( | |
138 BrowserThread::UI, FROM_HERE, | |
139 base::Bind( | |
140 &ChromeRenderMessageFilter::OnFPS, this, | |
141 routing_id, fps)); | |
142 return; | |
143 } | |
144 | |
145 #if defined(ENABLE_TASK_MANAGER) | |
146 TaskManager::GetInstance()->model()->NotifyFPS( | |
147 peer_pid(), routing_id, fps); | |
148 #endif // defined(ENABLE_TASK_MANAGER) | |
149 } | |
150 | |
151 void ChromeRenderMessageFilter::OnV8HeapStats(int v8_memory_allocated, | 134 void ChromeRenderMessageFilter::OnV8HeapStats(int v8_memory_allocated, |
152 int v8_memory_used) { | 135 int v8_memory_used) { |
153 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 136 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
154 BrowserThread::PostTask( | 137 BrowserThread::PostTask( |
155 BrowserThread::UI, FROM_HERE, | 138 BrowserThread::UI, FROM_HERE, |
156 base::Bind(&ChromeRenderMessageFilter::OnV8HeapStats, this, | 139 base::Bind(&ChromeRenderMessageFilter::OnV8HeapStats, this, |
157 v8_memory_allocated, v8_memory_used)); | 140 v8_memory_allocated, v8_memory_used)); |
158 return; | 141 return; |
159 } | 142 } |
160 | 143 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 base::Bind(&TabSpecificContentSettings::IndexedDBAccessed, | 239 base::Bind(&TabSpecificContentSettings::IndexedDBAccessed, |
257 render_process_id_, render_frame_id, origin_url, name, | 240 render_process_id_, render_frame_id, origin_url, name, |
258 !*allowed)); | 241 !*allowed)); |
259 } | 242 } |
260 | 243 |
261 #if defined(ENABLE_PLUGINS) | 244 #if defined(ENABLE_PLUGINS) |
262 void ChromeRenderMessageFilter::OnIsCrashReportingEnabled(bool* enabled) { | 245 void ChromeRenderMessageFilter::OnIsCrashReportingEnabled(bool* enabled) { |
263 *enabled = ChromeMetricsServiceAccessor::IsCrashReportingEnabled(); | 246 *enabled = ChromeMetricsServiceAccessor::IsCrashReportingEnabled(); |
264 } | 247 } |
265 #endif | 248 #endif |
OLD | NEW |