OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 return BrowserChildProcessHost::Send(msg); | 367 return BrowserChildProcessHost::Send(msg); |
368 } | 368 } |
369 | 369 |
370 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { | 370 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { |
371 DCHECK(CalledOnValidThread()); | 371 DCHECK(CalledOnValidThread()); |
372 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) | 372 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) |
373 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) | 373 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) |
374 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) | 374 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) |
375 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) | 375 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) |
376 IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, | |
377 OnGraphicsInfoCollected) | |
378 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) | 376 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) |
379 IPC_END_MESSAGE_MAP() | 377 IPC_END_MESSAGE_MAP() |
380 | 378 |
381 return true; | 379 return true; |
382 } | 380 } |
383 | 381 |
384 void GpuProcessHost::OnChannelConnected(int32 peer_pid) { | 382 void GpuProcessHost::OnChannelConnected(int32 peer_pid) { |
385 BrowserChildProcessHost::OnChannelConnected(peer_pid); | 383 BrowserChildProcessHost::OnChannelConnected(peer_pid); |
386 while (!queued_messages_.empty()) { | 384 while (!queued_messages_.empty()) { |
387 Send(queued_messages_.front()); | 385 Send(queued_messages_.front()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 gfx::PluginWindowHandle window, int32 renderer_id, | 493 gfx::PluginWindowHandle window, int32 renderer_id, |
496 int32 render_view_id) { | 494 int32 render_view_id) { |
497 #if defined(TOOLKIT_USES_GTK) | 495 #if defined(TOOLKIT_USES_GTK) |
498 ViewID view_id(renderer_id, render_view_id); | 496 ViewID view_id(renderer_id, render_view_id); |
499 SurfaceRefMap::iterator it = surface_refs_.find(view_id); | 497 SurfaceRefMap::iterator it = surface_refs_.find(view_id); |
500 if (it != surface_refs_.end()) | 498 if (it != surface_refs_.end()) |
501 surface_refs_.erase(it); | 499 surface_refs_.erase(it); |
502 #endif // defined(TOOLKIT_USES_GTK) | 500 #endif // defined(TOOLKIT_USES_GTK) |
503 } | 501 } |
504 | 502 |
505 void GpuProcessHost::OnGraphicsInfoCollected(const content::GPUInfo& gpu_info) { | |
506 // OnGraphicsInfoCollected is sent back after the GPU process successfully | |
507 // initializes GL. | |
508 TRACE_EVENT0("test_gpu", "OnGraphicsInfoCollected"); | |
509 | |
510 GpuDataManager::GetInstance()->UpdateGpuInfo(gpu_info); | |
511 } | |
512 | |
513 void GpuProcessHost::OnProcessLaunched() { | 503 void GpuProcessHost::OnProcessLaunched() { |
514 // Send the GPU process handle to the UI thread before it has to | 504 // Send the GPU process handle to the UI thread before it has to |
515 // respond to any requests to establish a GPU channel. The response | 505 // respond to any requests to establish a GPU channel. The response |
516 // to such requests require that the GPU process handle be known. | 506 // to such requests require that the GPU process handle be known. |
517 | 507 |
518 base::ProcessHandle child_handle = in_process_ ? | 508 base::ProcessHandle child_handle = in_process_ ? |
519 base::GetCurrentProcessHandle() : handle(); | 509 base::GetCurrentProcessHandle() : handle(); |
520 | 510 |
521 #if defined(OS_WIN) | 511 #if defined(OS_WIN) |
522 DuplicateHandle(base::GetCurrentProcessHandle(), | 512 DuplicateHandle(base::GetCurrentProcessHandle(), |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); | 633 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); |
644 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); | 634 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); |
645 } | 635 } |
646 | 636 |
647 void GpuProcessHost::CreateCommandBufferError( | 637 void GpuProcessHost::CreateCommandBufferError( |
648 CreateCommandBufferCallback* callback, int32 route_id) { | 638 CreateCommandBufferCallback* callback, int32 route_id) { |
649 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> | 639 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> |
650 wrapped_callback(callback); | 640 wrapped_callback(callback); |
651 callback->Run(route_id); | 641 callback->Run(route_id); |
652 } | 642 } |
OLD | NEW |