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

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: feedback 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/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
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 std::string str;
441 for (auto it : vector) {
442 if (!str.empty())
443 str += ",";
444 str += base::UintToString(it);
445 }
446 return str;
447 }
448
449 } // namespace 440 } // namespace
450 441
451 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; 442 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL;
452 443
453 base::MessageLoop* g_in_process_thread; 444 base::MessageLoop* g_in_process_thread;
454 445
455 base::MessageLoop* 446 base::MessageLoop*
456 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { 447 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() {
457 return g_in_process_thread; 448 return g_in_process_thread;
458 } 449 }
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 command_line->AppendSwitch(switches::kForceGpuRasterization); 1274 command_line->AppendSwitch(switches::kForceGpuRasterization);
1284 1275
1285 if (IsGpuMemoryBufferCompositorResourcesEnabled()) { 1276 if (IsGpuMemoryBufferCompositorResourcesEnabled()) {
1286 command_line->AppendSwitch( 1277 command_line->AppendSwitch(
1287 switches::kEnableGpuMemoryBufferCompositorResources); 1278 switches::kEnableGpuMemoryBufferCompositorResources);
1288 } 1279 }
1289 1280
1290 if (IsMainFrameBeforeActivationEnabled()) 1281 if (IsMainFrameBeforeActivationEnabled())
1291 command_line->AppendSwitch(cc::switches::kEnableMainFrameBeforeActivation); 1282 command_line->AppendSwitch(cc::switches::kEnableMainFrameBeforeActivation);
1292 1283
1293 // Persistent buffers may come at a performance hit (not all platform specific 1284 cc::BufferToTextureTargetMap image_targets;
1294 // buffers support it), so only enable them if partial raster is enabled and 1285 for (size_t usage_idx = 0;
1295 // we are actually going to use them. 1286 usage_idx < static_cast<size_t>(gfx::BufferUsage::LAST) + 1;
1296 // TODO(dcastagna): Once GPU_READ_CPU_READ_WRITE_PERSISTENT is removed 1287 ++usage_idx) {
1297 // kContentImageTextureTarget and kVideoImageTextureTarget can be merged into 1288 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
1298 // one flag. 1289 for (size_t format_idx = 0;
1299 gfx::BufferUsage buffer_usage = 1290 format_idx < static_cast<size_t>(gfx::BufferFormat::LAST) + 1;
1300 IsPartialRasterEnabled() 1291 ++format_idx) {
1301 ? gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT 1292 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
1302 : gfx::BufferUsage::GPU_READ_CPU_READ_WRITE; 1293 uint32_t target =
1303 std::vector<unsigned> image_targets( 1294 BrowserGpuMemoryBufferManager::GetImageTextureTarget(format, usage);
1304 static_cast<size_t>(gfx::BufferFormat::LAST) + 1, GL_TEXTURE_2D); 1295 image_targets.emplace(cc::BufferToTextureTargetKey(usage, format),
1305 for (size_t format = 0; 1296 target);
1306 format < static_cast<size_t>(gfx::BufferFormat::LAST) + 1; format++) { 1297 }
1307 image_targets[format] =
1308 BrowserGpuMemoryBufferManager::GetImageTextureTarget(
1309 static_cast<gfx::BufferFormat>(format), buffer_usage);
1310 } 1298 }
1311 command_line->AppendSwitchASCII(switches::kContentImageTextureTarget, 1299 command_line->AppendSwitchASCII(
1312 UintVectorToString(image_targets)); 1300 switches::kContentImageTextureTarget,
1313 1301 cc::BufferToTextureTargetMapToString(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 1302
1324 // Appending disable-gpu-feature switches due to software rendering list. 1303 // Appending disable-gpu-feature switches due to software rendering list.
1325 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); 1304 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
1326 DCHECK(gpu_data_manager); 1305 DCHECK(gpu_data_manager);
1327 gpu_data_manager->AppendRendererCommandLine(command_line); 1306 gpu_data_manager->AppendRendererCommandLine(command_line);
1328 } 1307 }
1329 1308
1330 void RenderProcessHostImpl::AppendRendererCommandLine( 1309 void RenderProcessHostImpl::AppendRendererCommandLine(
1331 base::CommandLine* command_line) const { 1310 base::CommandLine* command_line) const {
1332 // Pass the process type first, so it shows first in process listings. 1311 // Pass the process type first, so it shows first in process listings.
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2746 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2768 2747
2769 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2748 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2770 // enough information here so that we can determine what the bad message was. 2749 // enough information here so that we can determine what the bad message was.
2771 base::debug::Alias(&error); 2750 base::debug::Alias(&error);
2772 bad_message::ReceivedBadMessage(process.get(), 2751 bad_message::ReceivedBadMessage(process.get(),
2773 bad_message::RPH_MOJO_PROCESS_ERROR); 2752 bad_message::RPH_MOJO_PROCESS_ERROR);
2774 } 2753 }
2775 2754
2776 } // namespace content 2755 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698