Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 20777009: A few more cleanups to the pepper code. Dispatch IPCs in the sockets implementations directly by ha… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix tcp tests Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/allocator/allocator_extension.h" 12 #include "base/allocator/allocator_extension.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
15 #include "base/files/file_util_proxy.h"
15 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/memory/discardable_memory.h" 18 #include "base/memory/discardable_memory.h"
18 #include "base/memory/shared_memory.h" 19 #include "base/memory/shared_memory.h"
19 #include "base/metrics/field_trial.h" 20 #include "base/metrics/field_trial.h"
20 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
21 #include "base/metrics/stats_table.h" 22 #include "base/metrics/stats_table.h"
22 #include "base/path_service.h" 23 #include "base/path_service.h"
23 #include "base/strings/string16.h" 24 #include "base/strings/string16.h"
24 #include "base/strings/string_tokenizer.h" 25 #include "base/strings/string_tokenizer.h"
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL, 1131 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL,
1131 OnSetZoomLevelForCurrentURL) 1132 OnSetZoomLevelForCurrentURL)
1132 // TODO(port): removed from render_messages_internal.h; 1133 // TODO(port): removed from render_messages_internal.h;
1133 // is there a new non-windows message I should add here? 1134 // is there a new non-windows message I should add here?
1134 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) 1135 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView)
1135 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) 1136 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache)
1136 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) 1137 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged)
1137 IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) 1138 IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData)
1138 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended, 1139 IPC_MESSAGE_HANDLER(ViewMsg_SetWebKitSharedTimersSuspended,
1139 OnSetWebKitSharedTimersSuspended) 1140 OnSetWebKitSharedTimersSuspended)
1141 IPC_MESSAGE_HANDLER(ViewMsg_AsyncOpenFile_ACK, OnAsyncFileOpened)
1140 IPC_MESSAGE_UNHANDLED(handled = false) 1142 IPC_MESSAGE_UNHANDLED(handled = false)
1141 IPC_END_MESSAGE_MAP() 1143 IPC_END_MESSAGE_MAP()
1142 return handled; 1144 return handled;
1143 } 1145 }
1144 1146
1145 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { 1147 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) {
1146 EnsureWebKitInitialized(); 1148 EnsureWebKitInitialized();
1147 // When bringing in render_view, also bring in webkit's glue and jsbindings. 1149 // When bringing in render_view, also bring in webkit's glue and jsbindings.
1148 RenderViewImpl::Create( 1150 RenderViewImpl::Create(
1149 params.opener_route_id, 1151 params.opener_route_id,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 1271
1270 void RenderThreadImpl::OnTempCrashWithData(const GURL& data) { 1272 void RenderThreadImpl::OnTempCrashWithData(const GURL& data) {
1271 GetContentClient()->SetActiveURL(data); 1273 GetContentClient()->SetActiveURL(data);
1272 CHECK(false); 1274 CHECK(false);
1273 } 1275 }
1274 1276
1275 void RenderThreadImpl::OnSetWebKitSharedTimersSuspended(bool suspend) { 1277 void RenderThreadImpl::OnSetWebKitSharedTimersSuspended(bool suspend) {
1276 ToggleWebKitSharedTimer(suspend); 1278 ToggleWebKitSharedTimer(suspend);
1277 } 1279 }
1278 1280
1281 void RenderThreadImpl::OnAsyncFileOpened(
1282 base::PlatformFileError error_code,
1283 IPC::PlatformFileForTransit file_for_transit,
1284 int message_id) {
1285 AsyncOpenFileCallback* callback =
dmichael (off chromium) 2013/08/01 22:43:01 nit: scoped_ptr?
1286 pending_async_open_files_.Lookup(message_id);
1287 DCHECK(callback);
1288 pending_async_open_files_.Remove(message_id);
1289
1290 base::PlatformFile file =
1291 IPC::PlatformFileForTransitToPlatformFile(file_for_transit);
1292 callback->Run(error_code, base::PassPlatformFile(&file));
1293 // Make sure we won't leak file handle if the requester has died.
1294 if (file != base::kInvalidPlatformFileValue) {
1295 base::FileUtilProxy::Close(
1296 GetFileThreadMessageLoopProxy().get(),
1297 file,
1298 base::FileUtilProxy::StatusCallback());
1299 }
1300 delete callback;
1301 }
1302
1279 void RenderThreadImpl::OnMemoryPressure( 1303 void RenderThreadImpl::OnMemoryPressure(
1280 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { 1304 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
1281 base::allocator::ReleaseFreeMemory(); 1305 base::allocator::ReleaseFreeMemory();
1282 1306
1283 if (memory_pressure_level == 1307 if (memory_pressure_level ==
1284 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) { 1308 base::MemoryPressureListener::MEMORY_PRESSURE_CRITICAL) {
1285 // Trigger full v8 garbage collection on critical memory notification. 1309 // Trigger full v8 garbage collection on critical memory notification.
1286 v8::V8::LowMemoryNotification(); 1310 v8::V8::LowMemoryNotification();
1287 // Clear the image cache. 1311 // Clear the image cache.
1288 WebKit::WebImageCache::clear(); 1312 WebKit::WebImageCache::clear();
(...skipping 22 matching lines...) Expand all
1311 media_thread_->Start(); 1335 media_thread_->Start();
1312 } 1336 }
1313 return media_thread_->message_loop_proxy(); 1337 return media_thread_->message_loop_proxy();
1314 } 1338 }
1315 1339
1316 void RenderThreadImpl::SetFlingCurveParameters( 1340 void RenderThreadImpl::SetFlingCurveParameters(
1317 const std::vector<float>& new_touchpad, 1341 const std::vector<float>& new_touchpad,
1318 const std::vector<float>& new_touchscreen) { 1342 const std::vector<float>& new_touchscreen) {
1319 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1343 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1320 new_touchscreen); 1344 new_touchscreen);
1345 }
1321 1346
1347 void RenderThreadImpl::AsyncOpenFile(const base::FilePath& path,
1348 int flags,
1349 const AsyncOpenFileCallback& callback) {
1350 int message_id = pending_async_open_files_.Add(
1351 new AsyncOpenFileCallback(callback));
1352 Send(new ViewHostMsg_AsyncOpenFile(path, flags, message_id));
1322 } 1353 }
1323 1354
1324 } // namespace content 1355 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698