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

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

Issue 2772193006: gpu: Replace GpuMsg_GpuSwitched with mojom api. (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/gpu/gpu_child_thread.h ('k') | services/ui/gpu/gpu_service.h » ('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 22 matching lines...) Expand all
33 #include "ipc/ipc_channel_handle.h" 33 #include "ipc/ipc_channel_handle.h"
34 #include "ipc/ipc_sync_message_filter.h" 34 #include "ipc/ipc_sync_message_filter.h"
35 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" 35 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
36 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h" 36 #include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
37 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" 37 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
38 #include "media/gpu/ipc/service/media_gpu_channel_manager.h" 38 #include "media/gpu/ipc/service/media_gpu_channel_manager.h"
39 #include "services/service_manager/public/cpp/interface_registry.h" 39 #include "services/service_manager/public/cpp/interface_registry.h"
40 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" 40 #include "services/ui/gpu/interfaces/gpu_service.mojom.h"
41 #include "ui/gl/gl_implementation.h" 41 #include "ui/gl/gl_implementation.h"
42 #include "ui/gl/gl_switches.h" 42 #include "ui/gl/gl_switches.h"
43 #include "ui/gl/gpu_switching_manager.h"
44 #include "ui/gl/init/gl_factory.h" 43 #include "ui/gl/init/gl_factory.h"
45 #include "url/gurl.h" 44 #include "url/gurl.h"
46 45
47 #if defined(USE_OZONE) 46 #if defined(USE_OZONE)
48 #include "ui/ozone/public/ozone_platform.h" 47 #include "ui/ozone/public/ozone_platform.h"
49 #endif 48 #endif
50 49
51 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
52 #include "media/base/android/media_drm_bridge_client.h" 51 #include "media/base/android/media_drm_bridge_client.h"
53 #endif 52 #endif
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 165 }
167 166
168 bool GpuChildThread::Send(IPC::Message* msg) { 167 bool GpuChildThread::Send(IPC::Message* msg) {
169 // The GPU process must never send a synchronous IPC message to the browser 168 // The GPU process must never send a synchronous IPC message to the browser
170 // process. This could result in deadlock. 169 // process. This could result in deadlock.
171 DCHECK(!msg->is_sync()); 170 DCHECK(!msg->is_sync());
172 171
173 return ChildThreadImpl::Send(msg); 172 return ChildThreadImpl::Send(msg);
174 } 173 }
175 174
176 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) {
177 bool handled = true;
178 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
179 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched)
180 IPC_MESSAGE_UNHANDLED(handled = false)
181 IPC_END_MESSAGE_MAP()
182
183 return handled;
184 }
185
186 void GpuChildThread::OnAssociatedInterfaceRequest( 175 void GpuChildThread::OnAssociatedInterfaceRequest(
187 const std::string& name, 176 const std::string& name,
188 mojo::ScopedInterfaceEndpointHandle handle) { 177 mojo::ScopedInterfaceEndpointHandle handle) {
189 if (associated_interfaces_.CanBindRequest(name)) 178 if (associated_interfaces_.CanBindRequest(name))
190 associated_interfaces_.BindRequest(name, std::move(handle)); 179 associated_interfaces_.BindRequest(name, std::move(handle));
191 else 180 else
192 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle)); 181 ChildThreadImpl::OnAssociatedInterfaceRequest(name, std::move(handle));
193 } 182 }
194 183
195 void GpuChildThread::CreateGpuService( 184 void GpuChildThread::CreateGpuService(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 225
237 GetInterfaceRegistry()->ResumeBinding(); 226 GetInterfaceRegistry()->ResumeBinding();
238 } 227 }
239 228
240 void GpuChildThread::CreateDisplayCompositor( 229 void GpuChildThread::CreateDisplayCompositor(
241 cc::mojom::DisplayCompositorRequest request, 230 cc::mojom::DisplayCompositorRequest request,
242 cc::mojom::DisplayCompositorClientPtr client) { 231 cc::mojom::DisplayCompositorClientPtr client) {
243 NOTREACHED(); 232 NOTREACHED();
244 } 233 }
245 234
246 void GpuChildThread::OnGpuSwitched() {
247 DVLOG(1) << "GPU: GPU has switched";
248 // Notify observers in the GPU process.
249 if (!in_browser_process_)
250 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
251 }
252
253 void GpuChildThread::BindServiceFactoryRequest( 235 void GpuChildThread::BindServiceFactoryRequest(
254 service_manager::mojom::ServiceFactoryRequest request) { 236 service_manager::mojom::ServiceFactoryRequest request) {
255 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; 237 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
256 DCHECK(service_factory_); 238 DCHECK(service_factory_);
257 service_factory_bindings_.AddBinding(service_factory_.get(), 239 service_factory_bindings_.AddBinding(service_factory_.get(),
258 std::move(request)); 240 std::move(request));
259 } 241 }
260 242
261 } // namespace content 243 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | services/ui/gpu/gpu_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698