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

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

Issue 1218783003: Revert of 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(const InProcessChildThreadParams& params) 133 GpuChildThread::GpuChildThread(
134 const InProcessChildThreadParams& params,
135 GpuMemoryBufferFactory* gpu_memory_buffer_factory)
134 : ChildThreadImpl(ChildThreadImpl::Options::Builder() 136 : ChildThreadImpl(ChildThreadImpl::Options::Builder()
135 .InBrowserProcess(params) 137 .InBrowserProcess(params)
138 .AddStartupFilter(new GpuMemoryBufferMessageFilter(
139 gpu_memory_buffer_factory))
136 .Build()), 140 .Build()),
137 dead_on_arrival_(false), 141 dead_on_arrival_(false),
138 in_browser_process_(true), 142 in_browser_process_(true),
139 gpu_memory_buffer_factory_(nullptr) { 143 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) {
140 #if defined(OS_WIN) 144 #if defined(OS_WIN)
141 target_services_ = NULL; 145 target_services_ = NULL;
142 #endif 146 #endif
143 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 147 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
144 switches::kSingleProcess) || 148 switches::kSingleProcess) ||
145 base::CommandLine::ForCurrentProcess()->HasSwitch( 149 base::CommandLine::ForCurrentProcess()->HasSwitch(
146 switches::kInProcessGPU)); 150 switches::kInProcessGPU));
147 151
148 if (!gfx::GLSurface::InitializeOneOff()) 152 if (!gfx::GLSurface::InitializeOneOff())
149 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; 153 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
150 154
151 g_thread_safe_sender.Get() = thread_safe_sender(); 155 g_thread_safe_sender.Get() = thread_safe_sender();
152 } 156 }
153 157
154 GpuChildThread::~GpuChildThread() { 158 GpuChildThread::~GpuChildThread() {
155 } 159 }
156 160
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
157 void GpuChildThread::Shutdown() { 170 void GpuChildThread::Shutdown() {
158 ChildThreadImpl::Shutdown(); 171 ChildThreadImpl::Shutdown();
159 logging::SetLogMessageHandler(NULL); 172 logging::SetLogMessageHandler(NULL);
160 } 173 }
161 174
162 void GpuChildThread::Init(const base::Time& process_start_time) { 175 void GpuChildThread::Init(const base::Time& process_start_time) {
163 process_start_time_ = process_start_time; 176 process_start_time_ = process_start_time;
164 } 177 }
165 178
166 bool GpuChildThread::Send(IPC::Message* msg) { 179 bool GpuChildThread::Send(IPC::Message* msg) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 348 }
336 349
337 void GpuChildThread::OnGpuSwitched() { 350 void GpuChildThread::OnGpuSwitched() {
338 DVLOG(1) << "GPU: GPU has switched"; 351 DVLOG(1) << "GPU: GPU has switched";
339 // Notify observers in the GPU process. 352 // Notify observers in the GPU process.
340 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); 353 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
341 } 354 }
342 355
343 } // namespace content 356 } // namespace content
344 357
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