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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use the correct baseline Created 8 years, 4 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
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/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/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 const gfx::GLSurfaceHandle& compositing_surface, 522 const gfx::GLSurfaceHandle& compositing_surface,
523 int surface_id, 523 int surface_id,
524 int client_id, 524 int client_id,
525 const GPUCreateCommandBufferConfig& init_params, 525 const GPUCreateCommandBufferConfig& init_params,
526 const CreateCommandBufferCallback& callback) { 526 const CreateCommandBufferCallback& callback) {
527 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::CreateViewCommandBuffer"); 527 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::CreateViewCommandBuffer");
528 528
529 DCHECK(CalledOnValidThread()); 529 DCHECK(CalledOnValidThread());
530 530
531 #if defined(TOOLKIT_GTK) 531 #if defined(TOOLKIT_GTK)
532 // There should only be one such command buffer (for the compositor). In
533 // practice, if the GPU process lost a context, GraphicsContext3D with
534 // associated command buffer and view surface will not be gone until new
535 // one is in place and all layers are reattached.
536 linked_ptr<SurfaceRef> surface_ref; 532 linked_ptr<SurfaceRef> surface_ref;
537 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 533 if (compositing_surface.handle) {
538 if (it != surface_refs_.end()) 534 // There should only be one such command buffer (for the compositor). In
539 surface_ref = (*it).second; 535 // practice, if the GPU process lost a context, GraphicsContext3D with
540 else 536 // associated command buffer and view surface will not be gone until new
541 surface_ref.reset(new SurfaceRef(compositing_surface.handle)); 537 // one is in place and all layers are reattached.
538 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
539 if (it != surface_refs_.end())
540 surface_ref = (*it).second;
541 else
542 surface_ref.reset(new SurfaceRef(compositing_surface.handle));
543 }
542 #endif // defined(TOOLKIT_GTK) 544 #endif // defined(TOOLKIT_GTK)
543 545
544 if (!compositing_surface.is_null() && 546 if (!compositing_surface.is_null() &&
545 Send(new GpuMsg_CreateViewCommandBuffer( 547 Send(new GpuMsg_CreateViewCommandBuffer(
546 compositing_surface, surface_id, client_id, init_params))) { 548 compositing_surface, surface_id, client_id, init_params))) {
547 create_command_buffer_requests_.push(callback); 549 create_command_buffer_requests_.push(callback);
548 #if defined(TOOLKIT_GTK) 550 #if defined(TOOLKIT_GTK)
549 surface_refs_.insert(std::make_pair(surface_id, surface_ref)); 551 if (compositing_surface.handle)
552 surface_refs_.insert(std::make_pair(surface_id, surface_ref));
550 #endif 553 #endif
551 } else { 554 } else {
552 CreateCommandBufferError(callback, MSG_ROUTING_NONE); 555 CreateCommandBufferError(callback, MSG_ROUTING_NONE);
553 } 556 }
554 } 557 }
555 558
556 void GpuProcessHost::OnChannelEstablished( 559 void GpuProcessHost::OnChannelEstablished(
557 const IPC::ChannelHandle& channel_handle) { 560 const IPC::ChannelHandle& channel_handle) {
558 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnChannelEstablished"); 561 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnChannelEstablished");
559 562
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 const IPC::ChannelHandle& channel_handle, 876 const IPC::ChannelHandle& channel_handle,
874 base::ProcessHandle renderer_process_for_gpu, 877 base::ProcessHandle renderer_process_for_gpu,
875 const content::GPUInfo& gpu_info) { 878 const content::GPUInfo& gpu_info) {
876 callback.Run(channel_handle, gpu_info); 879 callback.Run(channel_handle, gpu_info);
877 } 880 }
878 881
879 void GpuProcessHost::CreateCommandBufferError( 882 void GpuProcessHost::CreateCommandBufferError(
880 const CreateCommandBufferCallback& callback, int32 route_id) { 883 const CreateCommandBufferCallback& callback, int32 route_id) {
881 callback.Run(route_id); 884 callback.Run(route_id);
882 } 885 }
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_host_helper.cc ('k') | content/browser/gpu/gpu_process_host_ui_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698