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

Side by Side Diff: chrome/browser/gpu_process_host.cc

Issue 4815001: Use inner HWND for accelerated rendering on windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/gpu_process_host.h" 5 #include "chrome/browser/gpu_process_host.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 195 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
196 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 196 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
197 IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply) 197 IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
198 #if defined(OS_LINUX) 198 #if defined(OS_LINUX)
199 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID) 199 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID)
200 #elif defined(OS_MACOSX) 200 #elif defined(OS_MACOSX)
201 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface, 201 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
202 OnAcceleratedSurfaceSetIOSurface) 202 OnAcceleratedSurfaceSetIOSurface)
203 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 203 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
204 OnAcceleratedSurfaceBuffersSwapped) 204 OnAcceleratedSurfaceBuffersSwapped)
205 #elif defined(OS_WIN)
206 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateCompositorHostWindow,
207 OnCreateCompositorHostWindow)
205 #endif 208 #endif
206 // If the IO thread does not handle the message then automatically route it 209 // If the IO thread does not handle the message then automatically route it
207 // to the UI thread. The UI thread will report an error if it does not 210 // to the UI thread. The UI thread will report an error if it does not
208 // handle it. 211 // handle it.
209 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) 212 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
210 IPC_END_MESSAGE_MAP() 213 IPC_END_MESSAGE_MAP()
211 } 214 }
212 215
213 void GpuProcessHost::OnChannelEstablished( 216 void GpuProcessHost::OnChannelEstablished(
214 const IPC::ChannelHandle& channel_handle, 217 const IPC::ChannelHandle& channel_handle,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 343 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
341 int32 renderer_id, 344 int32 renderer_id,
342 int32 render_view_id, 345 int32 render_view_id,
343 gfx::PluginWindowHandle window, 346 gfx::PluginWindowHandle window,
344 uint64 surface_id) { 347 uint64 surface_id) {
345 BrowserThread::PostTask( 348 BrowserThread::PostTask(
346 BrowserThread::UI, FROM_HERE, 349 BrowserThread::UI, FROM_HERE,
347 new BuffersSwappedDispatcher( 350 new BuffersSwappedDispatcher(
348 renderer_id, render_view_id, window, surface_id)); 351 renderer_id, render_view_id, window, surface_id));
349 } 352 }
353
354 #elif defined(OS_WIN)
355
356 namespace {
357
358 void SendDelayedReply(IPC::Message* reply_msg) {
359 GpuProcessHost::Get()->Send(reply_msg);
360 }
361
362 void CreateCompositorHostWindowDispatcher(
363 int renderer_id,
364 int render_view_id,
365 IPC::Message* reply_msg) {
366 RenderViewHost* host = RenderViewHost::FromID(renderer_id,
367 render_view_id);
368 if (!host) {
369 return;
370 }
371
372 RenderWidgetHostView* view = host->view();
373 gfx::PluginWindowHandle id = view->CreateCompositorHostWindow();
374
375
376 GpuHostMsg_CreateCompositorHostWindow::WriteReplyParams(reply_msg, id);
377 BrowserThread::PostTask(
378 BrowserThread::IO, FROM_HERE,
379 NewRunnableFunction(&SendDelayedReply, reply_msg));
380 }
381
382 } // namespace
383
384 void GpuProcessHost::OnCreateCompositorHostWindow(
385 int32 renderer_id,
386 int32 render_view_id,
387 IPC::Message* reply_message) {
388 BrowserThread::PostTask(
389 BrowserThread::UI, FROM_HERE,
390 NewRunnableFunction(&CreateCompositorHostWindowDispatcher,
391 renderer_id, render_view_id, reply_message));
392 }
393
350 #endif 394 #endif
351 395
352 void GpuProcessHost::SendEstablishChannelReply( 396 void GpuProcessHost::SendEstablishChannelReply(
353 const IPC::ChannelHandle& channel, 397 const IPC::ChannelHandle& channel,
354 const GPUInfo& gpu_info, 398 const GPUInfo& gpu_info,
355 ResourceMessageFilter* filter) { 399 ResourceMessageFilter* filter) {
356 ViewMsg_GpuChannelEstablished* message = 400 ViewMsg_GpuChannelEstablished* message =
357 new ViewMsg_GpuChannelEstablished(channel, gpu_info); 401 new ViewMsg_GpuChannelEstablished(channel, gpu_info);
358 // If the renderer process is performing synchronous initialization, 402 // If the renderer process is performing synchronous initialization,
359 // it needs to handle this message before receiving the reply for 403 // it needs to handle this message before receiving the reply for
(...skipping 17 matching lines...) Expand all
377 421
378 bool GpuProcessHost::CanShutdown() { 422 bool GpuProcessHost::CanShutdown() {
379 return true; 423 return true;
380 } 424 }
381 425
382 void GpuProcessHost::OnProcessCrashed() { 426 void GpuProcessHost::OnProcessCrashed() {
383 // TODO(alokp): Update gpu process crash rate. 427 // TODO(alokp): Update gpu process crash rate.
384 BrowserChildProcessHost::OnProcessCrashed(); 428 BrowserChildProcessHost::OnProcessCrashed();
385 } 429 }
386 430
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698