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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 1210073003: Revert of content: Fix single process support for native GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | 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/gpu/gpu_child_thread.h" 5 #include "content/gpu/gpu_child_thread.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 deferred_messages_(deferred_messages), 123 deferred_messages_(deferred_messages),
124 in_browser_process_(false), 124 in_browser_process_(false),
125 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { 125 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) {
126 watchdog_thread_ = watchdog_thread; 126 watchdog_thread_ = watchdog_thread;
127 #if defined(OS_WIN) 127 #if defined(OS_WIN)
128 target_services_ = NULL; 128 target_services_ = NULL;
129 #endif 129 #endif
130 g_thread_safe_sender.Get() = thread_safe_sender(); 130 g_thread_safe_sender.Get() = thread_safe_sender();
131 } 131 }
132 132
133 GpuChildThread::GpuChildThread( 133 GpuChildThread::GpuChildThread(const InProcessChildThreadParams& params)
134 const InProcessChildThreadParams& params,
135 GpuMemoryBufferFactory* gpu_memory_buffer_factory)
136 : ChildThreadImpl(ChildThreadImpl::Options::Builder() 134 : ChildThreadImpl(ChildThreadImpl::Options::Builder()
137 .InBrowserProcess(params) 135 .InBrowserProcess(params)
138 .AddStartupFilter(new GpuMemoryBufferMessageFilter(
139 gpu_memory_buffer_factory))
140 .Build()), 136 .Build()),
141 dead_on_arrival_(false), 137 dead_on_arrival_(false),
142 in_browser_process_(true), 138 in_browser_process_(true),
143 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { 139 gpu_memory_buffer_factory_(nullptr) {
144 #if defined(OS_WIN) 140 #if defined(OS_WIN)
145 target_services_ = NULL; 141 target_services_ = NULL;
146 #endif 142 #endif
147 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 143 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
148 switches::kSingleProcess) || 144 switches::kSingleProcess) ||
149 base::CommandLine::ForCurrentProcess()->HasSwitch( 145 base::CommandLine::ForCurrentProcess()->HasSwitch(
150 switches::kInProcessGPU)); 146 switches::kInProcessGPU));
151 147
152 if (!gfx::GLSurface::InitializeOneOff()) 148 if (!gfx::GLSurface::InitializeOneOff())
153 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; 149 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
154 150
155 g_thread_safe_sender.Get() = thread_safe_sender(); 151 g_thread_safe_sender.Get() = thread_safe_sender();
156 } 152 }
157 153
158 GpuChildThread::~GpuChildThread() { 154 GpuChildThread::~GpuChildThread() {
159 } 155 }
160 156
161 // static
162 gfx::GpuMemoryBufferType GpuChildThread::GetGpuMemoryBufferFactoryType() {
163 std::vector<gfx::GpuMemoryBufferType> supported_types;
164 GpuMemoryBufferFactory::GetSupportedTypes(&supported_types);
165 DCHECK(!supported_types.empty());
166 // Note: We always use the preferred type.
167 return supported_types[0];
168 }
169
170 void GpuChildThread::Shutdown() { 157 void GpuChildThread::Shutdown() {
171 ChildThreadImpl::Shutdown(); 158 ChildThreadImpl::Shutdown();
172 logging::SetLogMessageHandler(NULL); 159 logging::SetLogMessageHandler(NULL);
173 } 160 }
174 161
175 void GpuChildThread::Init(const base::Time& process_start_time) { 162 void GpuChildThread::Init(const base::Time& process_start_time) {
176 process_start_time_ = process_start_time; 163 process_start_time_ = process_start_time;
177 } 164 }
178 165
179 bool GpuChildThread::Send(IPC::Message* msg) { 166 bool GpuChildThread::Send(IPC::Message* msg) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 335 }
349 336
350 void GpuChildThread::OnGpuSwitched() { 337 void GpuChildThread::OnGpuSwitched() {
351 DVLOG(1) << "GPU: GPU has switched"; 338 DVLOG(1) << "GPU: GPU has switched";
352 // Notify observers in the GPU process. 339 // Notify observers in the GPU process.
353 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 340 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
354 } 341 }
355 342
356 } // namespace content 343 } // namespace content
357 344
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698