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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2120713002: Fix use_image_texture_target inconsistencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix content browsertests Created 4 years, 5 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
OLDNEW
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
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/buffer_to_texture_target_map.h"
47 #include "components/memory_coordinator/browser/memory_coordinator.h" 48 #include "components/memory_coordinator/browser/memory_coordinator.h"
48 #include "components/memory_coordinator/common/memory_coordinator_features.h" 49 #include "components/memory_coordinator/common/memory_coordinator_features.h"
49 #include "components/scheduler/common/scheduler_switches.h" 50 #include "components/scheduler/common/scheduler_switches.h"
50 #include "components/tracing/common/tracing_switches.h" 51 #include "components/tracing/common/tracing_switches.h"
51 #include "components/webmessaging/broadcast_channel_provider.h" 52 #include "components/webmessaging/broadcast_channel_provider.h"
52 #include "content/browser/appcache/appcache_dispatcher_host.h" 53 #include "content/browser/appcache/appcache_dispatcher_host.h"
53 #include "content/browser/appcache/chrome_appcache_service.h" 54 #include "content/browser/appcache/chrome_appcache_service.h"
54 #include "content/browser/background_sync/background_sync_service_impl.h" 55 #include "content/browser/background_sync/background_sync_service_impl.h"
55 #include "content/browser/bad_message.h" 56 #include "content/browser/bad_message.h"
56 #include "content/browser/blob_storage/blob_dispatcher_host.h" 57 #include "content/browser/blob_storage/blob_dispatcher_host.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 void Release(int old_route_id) { 437 void Release(int old_route_id) {
437 session_storage_namespaces_awaiting_close_.erase(old_route_id); 438 session_storage_namespaces_awaiting_close_.erase(old_route_id);
438 } 439 }
439 440
440 private: 441 private:
441 std::map<int, SessionStorageNamespaceMap> 442 std::map<int, SessionStorageNamespaceMap>
442 session_storage_namespaces_awaiting_close_; 443 session_storage_namespaces_awaiting_close_;
443 DISALLOW_COPY_AND_ASSIGN(SessionStorageHolder); 444 DISALLOW_COPY_AND_ASSIGN(SessionStorageHolder);
444 }; 445 };
445 446
446 std::string UintVectorToString(const std::vector<unsigned>& vector) {
447 std::string str;
448 for (auto it : vector) {
449 if (!str.empty())
450 str += ",";
451 str += base::UintToString(it);
452 }
453 return str;
454 }
455
456 void CreateMemoryCoordinatorHandle( 447 void CreateMemoryCoordinatorHandle(
457 int render_process_id, 448 int render_process_id,
458 memory_coordinator::mojom::MemoryCoordinatorHandleRequest request) { 449 memory_coordinator::mojom::MemoryCoordinatorHandleRequest request) {
459 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle( 450 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle(
460 render_process_id, std::move(request)); 451 render_process_id, std::move(request));
461 } 452 }
462 453
463 } // namespace 454 } // namespace
464 455
465 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; 456 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL;
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 command_line->AppendSwitch(switches::kForceGpuRasterization); 1294 command_line->AppendSwitch(switches::kForceGpuRasterization);
1304 1295
1305 if (IsGpuMemoryBufferCompositorResourcesEnabled()) { 1296 if (IsGpuMemoryBufferCompositorResourcesEnabled()) {
1306 command_line->AppendSwitch( 1297 command_line->AppendSwitch(
1307 switches::kEnableGpuMemoryBufferCompositorResources); 1298 switches::kEnableGpuMemoryBufferCompositorResources);
1308 } 1299 }
1309 1300
1310 if (IsMainFrameBeforeActivationEnabled()) 1301 if (IsMainFrameBeforeActivationEnabled())
1311 command_line->AppendSwitch(cc::switches::kEnableMainFrameBeforeActivation); 1302 command_line->AppendSwitch(cc::switches::kEnableMainFrameBeforeActivation);
1312 1303
1313 // Persistent buffers may come at a performance hit (not all platform specific 1304 cc::BufferToTextureTargetMap image_targets;
1314 // buffers support it), so only enable them if partial raster is enabled and 1305 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
1315 // we are actually going to use them. 1306 ++usage_idx) {
1316 // TODO(dcastagna): Once GPU_READ_CPU_READ_WRITE_PERSISTENT is removed 1307 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
1317 // kContentImageTextureTarget and kVideoImageTextureTarget can be merged into 1308 for (int format_idx = 0;
1318 // one flag. 1309 format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
1319 gfx::BufferUsage buffer_usage = 1310 ++format_idx) {
1320 IsPartialRasterEnabled() 1311 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
1321 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT 1312 uint32_t target =
1322 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; 1313 BrowserGpuMemoryBufferManager::GetImageTextureTarget(format, usage);
1323 std::vector<unsigned> image_targets( 1314 image_targets.insert(cc::BufferToTextureTargetMap::value_type(
1324 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, GL_TEXTURE_2D); 1315 cc::BufferToTextureTargetKey(usage, format), target));
1325 for (size_t format = 0; 1316 }
1326 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) {
1327 image_targets[format] =
1328 BrowserGpuMemoryBufferManager::GetImageTextureTarget(
1329 static_cast<gfx::BufferFormat>(format), buffer_usage);
1330 } 1317 }
1331 command_line->AppendSwitchASCII(switches::kContentImageTextureTarget, 1318 command_line->AppendSwitchASCII(
1332 UintVectorToString(image_targets)); 1319 switches::kContentImageTextureTarget,
1333 1320 cc::BufferToTextureTargetMapToString(image_targets));
1334 for (size_t format = 0;
1335 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) {
1336 image_targets[format] =
1337 BrowserGpuMemoryBufferManager::GetImageTextureTarget(
1338 static_cast<gfx::BufferFormat>(format),
1339 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE);
1340 }
1341 command_line->AppendSwitchASCII(switches::kVideoImageTextureTarget,
1342 UintVectorToString(image_targets));
1343 1321
1344 // Appending disable-gpu-feature switches due to software rendering list. 1322 // Appending disable-gpu-feature switches due to software rendering list.
1345 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); 1323 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
1346 DCHECK(gpu_data_manager); 1324 DCHECK(gpu_data_manager);
1347 gpu_data_manager->AppendRendererCommandLine(command_line); 1325 gpu_data_manager->AppendRendererCommandLine(command_line);
1348 } 1326 }
1349 1327
1350 void RenderProcessHostImpl::AppendRendererCommandLine( 1328 void RenderProcessHostImpl::AppendRendererCommandLine(
1351 base::CommandLine* command_line) const { 1329 base::CommandLine* command_line) const {
1352 // Pass the process type first, so it shows first in process listings. 1330 // Pass the process type first, so it shows first in process listings.
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2774 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2797 2775
2798 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2776 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2799 // enough information here so that we can determine what the bad message was. 2777 // enough information here so that we can determine what the bad message was.
2800 base::debug::Alias(&error); 2778 base::debug::Alias(&error);
2801 bad_message::ReceivedBadMessage(process.get(), 2779 bad_message::ReceivedBadMessage(process.get(),
2802 bad_message::RPH_MOJO_PROCESS_ERROR); 2780 bad_message::RPH_MOJO_PROCESS_ERROR);
2803 } 2781 }
2804 2782
2805 } // namespace content 2783 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_settings_unittest.cc ('k') | content/renderer/gpu/compositor_dependencies.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698