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

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

Issue 1968933003: Do not create GpuVideoAcceleratorFactories if kDisableGpuCompositing is set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 10 #include <utility>
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 return result; 1380 return result;
1381 } 1381 }
1382 1382
1383 void RenderThreadImpl::PostponeIdleNotification() { 1383 void RenderThreadImpl::PostponeIdleNotification() {
1384 idle_notifications_to_skip_ = 2; 1384 idle_notifications_to_skip_ = 2;
1385 } 1385 }
1386 1386
1387 media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() { 1387 media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() {
1388 DCHECK(IsMainThread()); 1388 DCHECK(IsMainThread());
1389 1389
1390 // XXX: solution1
1391 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1392 if (cmd_line->HasSwitch(switches::kDisableGpuCompositing))
1393 return nullptr;
1394
1390 if (!gpu_factories_.empty()) { 1395 if (!gpu_factories_.empty()) {
1391 scoped_refptr<ContextProviderCommandBuffer> shared_context_provider = 1396 scoped_refptr<ContextProviderCommandBuffer> shared_context_provider =
1392 gpu_factories_.back()->ContextProviderMainThread(); 1397 gpu_factories_.back()->ContextProviderMainThread();
1393 if (shared_context_provider) { 1398 if (shared_context_provider) {
1394 cc::ContextProvider::ScopedContextLock lock( 1399 cc::ContextProvider::ScopedContextLock lock(
1395 shared_context_provider.get()); 1400 shared_context_provider.get());
1396 if (lock.ContextGL()->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { 1401 if (lock.ContextGL()->GetGraphicsResetStatusKHR() == GL_NO_ERROR) {
1397 return gpu_factories_.back(); 1402 return gpu_factories_.back();
1398 } else { 1403 } else {
1399 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = 1404 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner =
1400 GetMediaThreadTaskRunner(); 1405 GetMediaThreadTaskRunner();
1401 media_task_runner->PostTask( 1406 media_task_runner->PostTask(
1402 FROM_HERE, 1407 FROM_HERE,
1403 base::Bind( 1408 base::Bind(
1404 base::IgnoreResult( 1409 base::IgnoreResult(
1405 &RendererGpuVideoAcceleratorFactories::CheckContextLost), 1410 &RendererGpuVideoAcceleratorFactories::CheckContextLost),
1406 base::Unretained(gpu_factories_.back()))); 1411 base::Unretained(gpu_factories_.back())));
1407 } 1412 }
1408 } 1413 }
1409 } 1414 }
1410 1415
1411 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
1412
1413 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = 1416 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
1414 EstablishGpuChannelSync(CAUSE_FOR_GPU_LAUNCH_MEDIA_CONTEXT); 1417 EstablishGpuChannelSync(CAUSE_FOR_GPU_LAUNCH_MEDIA_CONTEXT);
1415 if (!gpu_channel_host) 1418 if (!gpu_channel_host)
1416 return nullptr; 1419 return nullptr;
1417 scoped_refptr<ContextProviderCommandBuffer> media_context_provider = 1420 scoped_refptr<ContextProviderCommandBuffer> media_context_provider =
1418 CreateOffscreenContext( 1421 CreateOffscreenContext(
1419 gpu_channel_host, command_buffer_metrics::RENDER_WORKER_CONTEXT, 1422 gpu_channel_host, command_buffer_metrics::RENDER_WORKER_CONTEXT,
1420 gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL); 1423 gpu::GPU_STREAM_DEFAULT, gpu::GpuStreamPriority::NORMAL);
1421 if (!media_context_provider->BindToCurrentThread()) 1424 if (!media_context_provider->BindToCurrentThread())
1422 return nullptr; 1425 return nullptr;
1423 media_context_provider->SetupLock(); 1426 media_context_provider->SetupLock();
1424 1427
1425 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = 1428 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner =
1426 GetMediaThreadTaskRunner(); 1429 GetMediaThreadTaskRunner();
1427 const bool enable_video_accelerator = 1430 const bool enable_video_accelerator =
1428 !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode); 1431 !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode);
1429 const bool enable_gpu_memory_buffer_video_frames = 1432 const bool enable_gpu_memory_buffer_video_frames =
1433 // XXX: solution2
1434 // !cmd_line->HasSwitch(switches::kDisableGpuCompositing) &&
1430 #if defined(OS_MACOSX) || defined(OS_LINUX) 1435 #if defined(OS_MACOSX) || defined(OS_LINUX)
1431 !cmd_line->HasSwitch(switches::kDisableGpuMemoryBufferVideoFrames); 1436 !cmd_line->HasSwitch(switches::kDisableGpuMemoryBufferVideoFrames);
1432 #else 1437 #else
1433 cmd_line->HasSwitch(switches::kEnableGpuMemoryBufferVideoFrames); 1438 cmd_line->HasSwitch(switches::kEnableGpuMemoryBufferVideoFrames);
1434 #endif 1439 #endif
1435 std::vector<unsigned> image_texture_targets; 1440 std::vector<unsigned> image_texture_targets;
1436 std::string video_frame_image_texture_target_string = 1441 std::string video_frame_image_texture_target_string =
1437 cmd_line->GetSwitchValueASCII(switches::kVideoImageTextureTarget); 1442 cmd_line->GetSwitchValueASCII(switches::kVideoImageTextureTarget);
1438 StringToUintVector(video_frame_image_texture_target_string, 1443 StringToUintVector(video_frame_image_texture_target_string,
1439 &image_texture_targets); 1444 &image_texture_targets);
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) 2088 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical)
2084 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; 2089 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate;
2085 2090
2086 blink::mainThreadIsolate()->MemoryPressureNotification( 2091 blink::mainThreadIsolate()->MemoryPressureNotification(
2087 v8_memory_pressure_level); 2092 v8_memory_pressure_level);
2088 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2093 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2089 v8_memory_pressure_level); 2094 v8_memory_pressure_level);
2090 } 2095 }
2091 2096
2092 } // namespace content 2097 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698