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

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

Issue 2781553002: gpu: Introduce separate mojo api for failed initialization. (Closed)
Patch Set: . Created 3 years, 9 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') | gpu/ipc/common/BUILD.gn » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 switches::kSingleProcess) || 181 switches::kSingleProcess) ||
182 base::CommandLine::ForCurrentProcess()->HasSwitch( 182 base::CommandLine::ForCurrentProcess()->HasSwitch(
183 switches::kInProcessGPU)); 183 switches::kInProcessGPU));
184 } 184 }
185 gpu_service_->set_in_host_process(in_browser_process_); 185 gpu_service_->set_in_host_process(in_browser_process_);
186 } 186 }
187 187
188 GpuChildThread::~GpuChildThread() { 188 GpuChildThread::~GpuChildThread() {
189 } 189 }
190 190
191 void GpuChildThread::Shutdown() {
192 ChildThreadImpl::Shutdown();
193 }
194
195 void GpuChildThread::Init(const base::Time& process_start_time) { 191 void GpuChildThread::Init(const base::Time& process_start_time) {
196 gpu_service_->set_start_time(process_start_time); 192 gpu_service_->set_start_time(process_start_time);
197 193
198 #if defined(OS_ANDROID) 194 #if defined(OS_ANDROID)
199 // When running in in-process mode, this has been set in the browser at 195 // When running in in-process mode, this has been set in the browser at
200 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun(). 196 // ChromeBrowserMainPartsAndroid::PreMainMessageLoopRun().
201 if (!in_browser_process_) 197 if (!in_browser_process_)
202 media::SetMediaDrmBridgeClient( 198 media::SetMediaDrmBridgeClient(
203 GetContentClient()->GetMediaDrmBridgeClient()); 199 GetContentClient()->GetMediaDrmBridgeClient());
204 #endif 200 #endif
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 gpu_service_->UpdateGPUInfoFromPreferences(gpu_preferences); 270 gpu_service_->UpdateGPUInfoFromPreferences(gpu_preferences);
275 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_service_->gpu_info(), 271 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_service_->gpu_info(),
276 gpu_service_->gpu_feature_info())); 272 gpu_service_->gpu_feature_info()));
277 for (const LogMessage& log : deferred_messages_) 273 for (const LogMessage& log : deferred_messages_)
278 gpu_host->RecordLogMessage(log.severity, log.header, log.message); 274 gpu_host->RecordLogMessage(log.severity, log.header, log.message);
279 deferred_messages_.clear(); 275 deferred_messages_.clear();
280 276
281 if (dead_on_arrival_) { 277 if (dead_on_arrival_) {
282 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; 278 LOG(ERROR) << "Exiting GPU process due to errors during initialization";
283 gpu_service_.reset(); 279 gpu_service_.reset();
280 gpu_host->DidFailInitialize();
284 base::MessageLoop::current()->QuitWhenIdle(); 281 base::MessageLoop::current()->QuitWhenIdle();
285 return; 282 return;
286 } 283 }
287 284
288 gpu::SyncPointManager* sync_point_manager = nullptr; 285 gpu::SyncPointManager* sync_point_manager = nullptr;
289 // Note SyncPointManager from ContentGpuClient cannot be owned by this. 286 // Note SyncPointManager from ContentGpuClient cannot be owned by this.
290 if (GetContentClient()->gpu()) 287 if (GetContentClient()->gpu())
291 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); 288 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager();
292 gpu_service_->InitializeWithHost( 289 gpu_service_->InitializeWithHost(
293 std::move(gpu_host), gpu_preferences, 290 std::move(gpu_host),
294 gpu::GpuProcessActivityFlags(std::move(activity_flags)), 291 gpu::GpuProcessActivityFlags(std::move(activity_flags)),
295 sync_point_manager, ChildProcess::current()->GetShutDownEvent()); 292 sync_point_manager, ChildProcess::current()->GetShutDownEvent());
296 CHECK(gpu_service_->media_gpu_channel_manager()); 293 CHECK(gpu_service_->media_gpu_channel_manager());
297 294
298 // Only set once per process instance. 295 // Only set once per process instance.
299 service_factory_.reset(new GpuServiceFactory( 296 service_factory_.reset(new GpuServiceFactory(
300 gpu_service_->media_gpu_channel_manager()->AsWeakPtr())); 297 gpu_service_->media_gpu_channel_manager()->AsWeakPtr()));
301 298
302 GetInterfaceRegistry()->AddInterface(base::Bind( 299 GetInterfaceRegistry()->AddInterface(base::Bind(
303 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); 300 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this)));
(...skipping 30 matching lines...) Expand all
334 331
335 void GpuChildThread::BindServiceFactoryRequest( 332 void GpuChildThread::BindServiceFactoryRequest(
336 service_manager::mojom::ServiceFactoryRequest request) { 333 service_manager::mojom::ServiceFactoryRequest request) {
337 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; 334 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
338 DCHECK(service_factory_); 335 DCHECK(service_factory_);
339 service_factory_bindings_.AddBinding(service_factory_.get(), 336 service_factory_bindings_.AddBinding(service_factory_.get(),
340 std::move(request)); 337 std::move(request));
341 } 338 }
342 339
343 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | gpu/ipc/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698