OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "base/strings/stringprintf.h" | 37 #include "base/strings/stringprintf.h" |
38 #include "base/supports_user_data.h" | 38 #include "base/supports_user_data.h" |
39 #include "base/sys_info.h" | 39 #include "base/sys_info.h" |
40 #include "base/threading/thread.h" | 40 #include "base/threading/thread.h" |
41 #include "base/threading/thread_restrictions.h" | 41 #include "base/threading/thread_restrictions.h" |
42 #include "base/threading/thread_task_runner_handle.h" | 42 #include "base/threading/thread_task_runner_handle.h" |
43 #include "base/trace_event/trace_event.h" | 43 #include "base/trace_event/trace_event.h" |
44 #include "base/tracked_objects.h" | 44 #include "base/tracked_objects.h" |
45 #include "build/build_config.h" | 45 #include "build/build_config.h" |
46 #include "cc/base/switches.h" | 46 #include "cc/base/switches.h" |
| 47 #include "cc/output/renderer_settings.h" |
47 #include "components/scheduler/common/scheduler_switches.h" | 48 #include "components/scheduler/common/scheduler_switches.h" |
48 #include "components/tracing/common/tracing_switches.h" | 49 #include "components/tracing/common/tracing_switches.h" |
49 #include "components/webmessaging/broadcast_channel_provider.h" | 50 #include "components/webmessaging/broadcast_channel_provider.h" |
50 #include "content/browser/appcache/appcache_dispatcher_host.h" | 51 #include "content/browser/appcache/appcache_dispatcher_host.h" |
51 #include "content/browser/appcache/chrome_appcache_service.h" | 52 #include "content/browser/appcache/chrome_appcache_service.h" |
52 #include "content/browser/background_sync/background_sync_service_impl.h" | 53 #include "content/browser/background_sync/background_sync_service_impl.h" |
53 #include "content/browser/bad_message.h" | 54 #include "content/browser/bad_message.h" |
54 #include "content/browser/blob_storage/blob_dispatcher_host.h" | 55 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
55 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 56 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
56 #include "content/browser/browser_child_process_host_impl.h" | 57 #include "content/browser/browser_child_process_host_impl.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 void Release(int old_route_id) { | 430 void Release(int old_route_id) { |
430 session_storage_namespaces_awaiting_close_.erase(old_route_id); | 431 session_storage_namespaces_awaiting_close_.erase(old_route_id); |
431 } | 432 } |
432 | 433 |
433 private: | 434 private: |
434 std::map<int, SessionStorageNamespaceMap> | 435 std::map<int, SessionStorageNamespaceMap> |
435 session_storage_namespaces_awaiting_close_; | 436 session_storage_namespaces_awaiting_close_; |
436 DISALLOW_COPY_AND_ASSIGN(SessionStorageHolder); | 437 DISALLOW_COPY_AND_ASSIGN(SessionStorageHolder); |
437 }; | 438 }; |
438 | 439 |
439 std::string UintVectorToString(const std::vector<unsigned>& vector) { | 440 // Converts an ImageTextureTargetsMap to a string representation of the format: |
| 441 // "usage,format,target;usage,format,target;...;usage,format,target" |
| 442 std::string ImageTextureTargetsMapToString( |
| 443 const cc::RendererSettings::ImageTextureTargetsMap& map) { |
440 std::string str; | 444 std::string str; |
441 for (auto it : vector) { | 445 for (const auto& entry : map) { |
442 if (!str.empty()) | 446 if (!str.empty()) |
443 str += ","; | 447 str += ";"; |
444 str += base::UintToString(it); | 448 str += base::UintToString(static_cast<uint32_t>(entry.first.first)); |
| 449 str += ","; |
| 450 str += base::UintToString(static_cast<uint32_t>(entry.first.second)); |
| 451 str += ","; |
| 452 str += base::UintToString(entry.second); |
445 } | 453 } |
446 return str; | 454 return str; |
447 } | 455 } |
448 | 456 |
449 } // namespace | 457 } // namespace |
450 | 458 |
451 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 459 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
452 | 460 |
453 base::MessageLoop* g_in_process_thread; | 461 base::MessageLoop* g_in_process_thread; |
454 | 462 |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 command_line->AppendSwitch(switches::kForceGpuRasterization); | 1291 command_line->AppendSwitch(switches::kForceGpuRasterization); |
1284 | 1292 |
1285 if (IsGpuMemoryBufferCompositorResourcesEnabled()) { | 1293 if (IsGpuMemoryBufferCompositorResourcesEnabled()) { |
1286 command_line->AppendSwitch( | 1294 command_line->AppendSwitch( |
1287 switches::kEnableGpuMemoryBufferCompositorResources); | 1295 switches::kEnableGpuMemoryBufferCompositorResources); |
1288 } | 1296 } |
1289 | 1297 |
1290 if (IsMainFrameBeforeActivationEnabled()) | 1298 if (IsMainFrameBeforeActivationEnabled()) |
1291 command_line->AppendSwitch(cc::switches::kEnableMainFrameBeforeActivation); | 1299 command_line->AppendSwitch(cc::switches::kEnableMainFrameBeforeActivation); |
1292 | 1300 |
1293 // Persistent buffers may come at a performance hit (not all platform specific | 1301 cc::RendererSettings::ImageTextureTargetsMap image_targets; |
1294 // buffers support it), so only enable them if partial raster is enabled and | 1302 for (size_t usage_idx = 0; |
1295 // we are actually going to use them. | 1303 usage_idx <= static_cast<size_t>(gfx::BufferUsage::LAST) + 1; |
1296 // TODO(dcastagna): Once GPU_READ_CPU_READ_WRITE_PERSISTENT is removed | 1304 ++usage_idx) { |
1297 // kContentImageTextureTarget and kVideoImageTextureTarget can be merged into | 1305 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx); |
1298 // one flag. | 1306 for (size_t format_idx = 0; |
1299 gfx::BufferUsage buffer_usage = | 1307 format_idx < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; |
1300 IsPartialRasterEnabled() | 1308 ++format_idx) { |
1301 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT | 1309 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx); |
1302 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; | 1310 uint32_t target = |
1303 std::vector<unsigned> image_targets( | 1311 BrowserGpuMemoryBufferManager::GetImageTextureTarget(format, usage); |
1304 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, GL_TEXTURE_2D); | 1312 image_targets.emplace( |
1305 for (size_t format = 0; | 1313 cc::RendererSettings::ImageTextureTargetKey(usage, format), target); |
1306 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { | 1314 } |
1307 image_targets[format] = | |
1308 BrowserGpuMemoryBufferManager::GetImageTextureTarget( | |
1309 static_cast<gfx::BufferFormat>(format), buffer_usage); | |
1310 } | 1315 } |
1311 command_line->AppendSwitchASCII(switches::kContentImageTextureTarget, | 1316 command_line->AppendSwitchASCII( |
1312 UintVectorToString(image_targets)); | 1317 switches::kContentImageTextureTarget, |
1313 | 1318 ImageTextureTargetsMapToString(image_targets)); |
1314 for (size_t format = 0; | |
1315 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { | |
1316 image_targets[format] = | |
1317 BrowserGpuMemoryBufferManager::GetImageTextureTarget( | |
1318 static_cast<gfx::BufferFormat>(format), | |
1319 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE); | |
1320 } | |
1321 command_line->AppendSwitchASCII(switches::kVideoImageTextureTarget, | |
1322 UintVectorToString(image_targets)); | |
1323 | 1319 |
1324 // Appending disable-gpu-feature switches due to software rendering list. | 1320 // Appending disable-gpu-feature switches due to software rendering list. |
1325 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | 1321 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); |
1326 DCHECK(gpu_data_manager); | 1322 DCHECK(gpu_data_manager); |
1327 gpu_data_manager->AppendRendererCommandLine(command_line); | 1323 gpu_data_manager->AppendRendererCommandLine(command_line); |
1328 } | 1324 } |
1329 | 1325 |
1330 void RenderProcessHostImpl::AppendRendererCommandLine( | 1326 void RenderProcessHostImpl::AppendRendererCommandLine( |
1331 base::CommandLine* command_line) const { | 1327 base::CommandLine* command_line) const { |
1332 // Pass the process type first, so it shows first in process listings. | 1328 // Pass the process type first, so it shows first in process listings. |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2767 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2763 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2768 | 2764 |
2769 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2765 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2770 // enough information here so that we can determine what the bad message was. | 2766 // enough information here so that we can determine what the bad message was. |
2771 base::debug::Alias(&error); | 2767 base::debug::Alias(&error); |
2772 bad_message::ReceivedBadMessage(process.get(), | 2768 bad_message::ReceivedBadMessage(process.get(), |
2773 bad_message::RPH_MOJO_PROCESS_ERROR); | 2769 bad_message::RPH_MOJO_PROCESS_ERROR); |
2774 } | 2770 } |
2775 | 2771 |
2776 } // namespace content | 2772 } // namespace content |
OLD | NEW |