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

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 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
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/browser/gpu_process_host_ui_shim.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) 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/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 170 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
171 IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply) 171 IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
172 #if defined(OS_LINUX) 172 #if defined(OS_LINUX)
173 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID) 173 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID)
174 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID) 174 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID)
175 #elif defined(OS_MACOSX) 175 #elif defined(OS_MACOSX)
176 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface, 176 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
177 OnAcceleratedSurfaceSetIOSurface) 177 OnAcceleratedSurfaceSetIOSurface)
178 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 178 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
179 OnAcceleratedSurfaceBuffersSwapped) 179 OnAcceleratedSurfaceBuffersSwapped)
180 #elif defined(OS_WIN)
181 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateCompositorHostWindow,
182 OnCreateCompositorHostWindow)
180 #endif 183 #endif
181 // If the IO thread does not handle the message then automatically route it 184 // If the IO thread does not handle the message then automatically route it
182 // to the UI thread. The UI thread will report an error if it does not 185 // to the UI thread. The UI thread will report an error if it does not
183 // handle it. 186 // handle it.
184 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) 187 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
185 IPC_END_MESSAGE_MAP() 188 IPC_END_MESSAGE_MAP()
186 } 189 }
187 190
188 void GpuProcessHost::OnChannelEstablished( 191 void GpuProcessHost::OnChannelEstablished(
189 const IPC::ChannelHandle& channel_handle, 192 const IPC::ChannelHandle& channel_handle,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 BrowserThread::PostTask( 301 BrowserThread::PostTask(
299 BrowserThread::UI, FROM_HERE, 302 BrowserThread::UI, FROM_HERE,
300 new SetIOSurfaceDispatcher(params)); 303 new SetIOSurfaceDispatcher(params));
301 } 304 }
302 305
303 namespace { 306 namespace {
304 307
305 class BuffersSwappedDispatcher : public Task { 308 class BuffersSwappedDispatcher : public Task {
306 public: 309 public:
307 BuffersSwappedDispatcher( 310 BuffersSwappedDispatcher(
308 int32 renderer_id, 311 int renderer_id,
309 int32 render_view_id, 312 int render_view_id,
310 gfx::PluginWindowHandle window, 313 gfx::PluginWindowHandle window,
311 uint64 surface_id, 314 uint64 surface_id,
312 int32 route_id, 315 int32 route_id,
313 uint64 swap_buffers_count) 316 uint64 swap_buffers_count)
314 : renderer_id_(renderer_id), 317 : renderer_id_(renderer_id),
315 render_view_id_(render_view_id), 318 render_view_id_(render_view_id),
316 window_(window), 319 window_(window),
317 surface_id_(surface_id), 320 surface_id_(surface_id),
318 route_id_(route_id), 321 route_id_(route_id),
319 swap_buffers_count_(swap_buffers_count) { 322 swap_buffers_count_(swap_buffers_count) {
(...skipping 11 matching lines...) Expand all
331 // Parameters needed to swap the IOSurface. 334 // Parameters needed to swap the IOSurface.
332 window_, 335 window_,
333 surface_id_, 336 surface_id_,
334 // Parameters needed to formulate an acknowledgment. 337 // Parameters needed to formulate an acknowledgment.
335 renderer_id_, 338 renderer_id_,
336 route_id_, 339 route_id_,
337 swap_buffers_count_); 340 swap_buffers_count_);
338 } 341 }
339 342
340 private: 343 private:
341 int32 renderer_id_; 344 int renderer_id_;
342 int32 render_view_id_; 345 int render_view_id_;
343 gfx::PluginWindowHandle window_; 346 gfx::PluginWindowHandle window_;
344 uint64 surface_id_; 347 uint64 surface_id_;
345 int32 route_id_; 348 int32 route_id_;
346 uint64 swap_buffers_count_; 349 uint64 swap_buffers_count_;
347 350
348 DISALLOW_COPY_AND_ASSIGN(BuffersSwappedDispatcher); 351 DISALLOW_COPY_AND_ASSIGN(BuffersSwappedDispatcher);
349 }; 352 };
350 353
351 } // namespace 354 } // namespace
352 355
353 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 356 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
354 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 357 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
355 BrowserThread::PostTask( 358 BrowserThread::PostTask(
356 BrowserThread::UI, FROM_HERE, 359 BrowserThread::UI, FROM_HERE,
357 new BuffersSwappedDispatcher( 360 new BuffersSwappedDispatcher(
358 // These are the parameters needed to look up the IOSurface 361 // These are the parameters needed to look up the IOSurface
359 // on this side. 362 // on this side.
360 params.renderer_id, 363 params.renderer_id,
361 params.render_view_id, 364 params.render_view_id,
362 params.window, 365 params.window,
363 params.surface_id, 366 params.surface_id,
364 // These are additional parameters needed to formulate an 367 // These are additional parameters needed to formulate an
365 // acknowledgment. 368 // acknowledgment.
366 params.route_id, 369 params.route_id,
367 params.swap_buffers_count)); 370 params.swap_buffers_count));
368 } 371 }
372
373 #elif defined(OS_WIN)
374
375 namespace {
376
377 void SendDelayedReply(IPC::Message* reply_msg) {
378 GpuProcessHost::Get()->Send(reply_msg);
379 }
380
381 void CreateCompositorHostWindowDispatcher(
382 int renderer_id,
383 int render_view_id,
384 IPC::Message* reply_msg) {
385 RenderViewHost* host = RenderViewHost::FromID(renderer_id,
386 render_view_id);
387 if (!host) {
388 return;
389 }
390
391 RenderWidgetHostView* view = host->view();
392 gfx::PluginWindowHandle id = view->CreateCompositorHostWindow();
393
394
395 GpuHostMsg_CreateCompositorHostWindow::WriteReplyParams(reply_msg, id);
396 BrowserThread::PostTask(
397 BrowserThread::IO, FROM_HERE,
398 NewRunnableFunction(&SendDelayedReply, reply_msg));
399 }
400
401 } // namespace
402
403 void GpuProcessHost::OnCreateCompositorHostWindow(
404 int renderer_id,
405 int render_view_id,
406 IPC::Message* reply_message) {
407 BrowserThread::PostTask(
408 BrowserThread::UI, FROM_HERE,
409 NewRunnableFunction(&CreateCompositorHostWindowDispatcher,
410 renderer_id, render_view_id, reply_message));
411 }
412
369 #endif 413 #endif
370 414
371 void GpuProcessHost::SendEstablishChannelReply( 415 void GpuProcessHost::SendEstablishChannelReply(
372 const IPC::ChannelHandle& channel, 416 const IPC::ChannelHandle& channel,
373 const GPUInfo& gpu_info, 417 const GPUInfo& gpu_info,
374 ResourceMessageFilter* filter) { 418 ResourceMessageFilter* filter) {
375 ViewMsg_GpuChannelEstablished* message = 419 ViewMsg_GpuChannelEstablished* message =
376 new ViewMsg_GpuChannelEstablished(channel, gpu_info); 420 new ViewMsg_GpuChannelEstablished(channel, gpu_info);
377 // If the renderer process is performing synchronous initialization, 421 // If the renderer process is performing synchronous initialization,
378 // it needs to handle this message before receiving the reply for 422 // it needs to handle this message before receiving the reply for
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 false, // Never use the zygote (GPU plugin can't be sandboxed). 498 false, // Never use the zygote (GPU plugin can't be sandboxed).
455 base::environment_vector(), 499 base::environment_vector(),
456 #endif 500 #endif
457 cmd_line); 501 cmd_line);
458 502
459 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", 503 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
460 kLaunched, kGPUProcessLifetimeEvent_Max); 504 kLaunched, kGPUProcessLifetimeEvent_Max);
461 return true; 505 return true;
462 } 506 }
463 507
OLDNEW
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/browser/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698