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

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

Issue 2801943002: gpu: Some code cleanups. (Closed)
Patch Set: . Created 3 years, 8 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/browser/gpu/gpu_process_host.cc ('k') | services/ui/gpu/gpu_service.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 <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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 associated_interfaces_.BindRequest(name, std::move(handle)); 158 associated_interfaces_.BindRequest(name, std::move(handle));
159 else 159 else
160 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); 160 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle));
161 } 161 }
162 162
163 void GpuChildThread::CreateGpuService( 163 void GpuChildThread::CreateGpuService(
164 ui::mojom::GpuServiceRequest request, 164 ui::mojom::GpuServiceRequest request,
165 ui::mojom::GpuHostPtr gpu_host, 165 ui::mojom::GpuHostPtr gpu_host,
166 const gpu::GpuPreferences& gpu_preferences, 166 const gpu::GpuPreferences& gpu_preferences,
167 mojo::ScopedSharedBufferHandle activity_flags) { 167 mojo::ScopedSharedBufferHandle activity_flags) {
168 gpu_service_->Bind(std::move(request));
169 gpu_service_->UpdateGPUInfoFromPreferences(gpu_preferences); 168 gpu_service_->UpdateGPUInfoFromPreferences(gpu_preferences);
170 for (const LogMessage& log : deferred_messages_) 169 for (const LogMessage& log : deferred_messages_)
171 gpu_host->RecordLogMessage(log.severity, log.header, log.message); 170 gpu_host->RecordLogMessage(log.severity, log.header, log.message);
172 deferred_messages_.clear(); 171 deferred_messages_.clear();
173 172
174 if (dead_on_arrival_) { 173 if (dead_on_arrival_) {
175 LOG(ERROR) << "Exiting GPU process due to errors during initialization"; 174 LOG(ERROR) << "Exiting GPU process due to errors during initialization";
176 gpu_service_.reset(); 175 gpu_service_.reset();
177 gpu_host->DidFailInitialize(); 176 gpu_host->DidFailInitialize();
178 base::MessageLoop::current()->QuitWhenIdle(); 177 base::MessageLoop::current()->QuitWhenIdle();
179 return; 178 return;
180 } 179 }
181 180
181 // Bind should happen only if initialization succeeds (i.e. not dead on
182 // arrival), because otherwise, it can receive requests from the host while in
183 // an uninitialized state.
184 gpu_service_->Bind(std::move(request));
182 gpu::SyncPointManager* sync_point_manager = nullptr; 185 gpu::SyncPointManager* sync_point_manager = nullptr;
183 // Note SyncPointManager from ContentGpuClient cannot be owned by this. 186 // Note SyncPointManager from ContentGpuClient cannot be owned by this.
184 if (GetContentClient()->gpu()) 187 if (GetContentClient()->gpu())
185 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager(); 188 sync_point_manager = GetContentClient()->gpu()->GetSyncPointManager();
186 gpu_service_->InitializeWithHost( 189 gpu_service_->InitializeWithHost(
187 std::move(gpu_host), 190 std::move(gpu_host),
188 gpu::GpuProcessActivityFlags(std::move(activity_flags)), 191 gpu::GpuProcessActivityFlags(std::move(activity_flags)),
189 sync_point_manager, ChildProcess::current()->GetShutDownEvent()); 192 sync_point_manager, ChildProcess::current()->GetShutDownEvent());
190 CHECK(gpu_service_->media_gpu_channel_manager()); 193 CHECK(gpu_service_->media_gpu_channel_manager());
191 194
(...skipping 21 matching lines...) Expand all
213 216
214 void GpuChildThread::BindServiceFactoryRequest( 217 void GpuChildThread::BindServiceFactoryRequest(
215 service_manager::mojom::ServiceFactoryRequest request) { 218 service_manager::mojom::ServiceFactoryRequest request) {
216 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; 219 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
217 DCHECK(service_factory_); 220 DCHECK(service_factory_);
218 service_factory_bindings_.AddBinding(service_factory_.get(), 221 service_factory_bindings_.AddBinding(service_factory_.get(),
219 std::move(request)); 222 std::move(request));
220 } 223 }
221 224
222 } // namespace content 225 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | services/ui/gpu/gpu_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698