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

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: Major changes to clean up deadlock & other issues 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 const gfx::GLSurfaceHandle& compositing_surface, 514 const gfx::GLSurfaceHandle& compositing_surface,
515 int surface_id, 515 int surface_id,
516 int client_id, 516 int client_id,
517 const GPUCreateCommandBufferConfig& init_params, 517 const GPUCreateCommandBufferConfig& init_params,
518 const CreateCommandBufferCallback& callback) { 518 const CreateCommandBufferCallback& callback) {
519 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::CreateViewCommandBuffer"); 519 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::CreateViewCommandBuffer");
520 520
521 DCHECK(CalledOnValidThread()); 521 DCHECK(CalledOnValidThread());
522 522
523 #if defined(TOOLKIT_GTK) 523 #if defined(TOOLKIT_GTK)
524 // There should only be one such command buffer (for the compositor). In
525 // practice, if the GPU process lost a context, GraphicsContext3D with
526 // associated command buffer and view surface will not be gone until new
527 // one is in place and all layers are reattached.
528 linked_ptr<SurfaceRef> surface_ref; 524 linked_ptr<SurfaceRef> surface_ref;
529 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 525 if (compositing_surface.handle) {
530 if (it != surface_refs_.end()) 526 // There should only be one such command buffer (for the compositor). In
531 surface_ref = (*it).second; 527 // practice, if the GPU process lost a context, GraphicsContext3D with
532 else 528 // associated command buffer and view surface will not be gone until new
533 surface_ref.reset(new SurfaceRef(compositing_surface.handle)); 529 // one is in place and all layers are reattached.
530 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
531 if (it != surface_refs_.end())
532 surface_ref = (*it).second;
533 else
534 surface_ref.reset(new SurfaceRef(compositing_surface.handle));
535 }
534 #endif // defined(TOOLKIT_GTK) 536 #endif // defined(TOOLKIT_GTK)
535 537
536 if (!compositing_surface.is_null() && 538 if (!compositing_surface.is_null() &&
537 Send(new GpuMsg_CreateViewCommandBuffer( 539 Send(new GpuMsg_CreateViewCommandBuffer(
538 compositing_surface, surface_id, client_id, init_params))) { 540 compositing_surface, surface_id, client_id, init_params))) {
539 create_command_buffer_requests_.push(callback); 541 create_command_buffer_requests_.push(callback);
540 #if defined(TOOLKIT_GTK) 542 #if defined(TOOLKIT_GTK)
541 surface_refs_.insert(std::make_pair(surface_id, surface_ref)); 543 if (compositing_surface.handle)
544 surface_refs_.insert(std::make_pair(surface_id, surface_ref));
542 #endif 545 #endif
543 } else { 546 } else {
544 CreateCommandBufferError(callback, MSG_ROUTING_NONE); 547 CreateCommandBufferError(callback, MSG_ROUTING_NONE);
545 } 548 }
546 } 549 }
547 550
548 void GpuProcessHost::OnChannelEstablished( 551 void GpuProcessHost::OnChannelEstablished(
549 const IPC::ChannelHandle& channel_handle) { 552 const IPC::ChannelHandle& channel_handle) {
550 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnChannelEstablished"); 553 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnChannelEstablished");
551 554
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 const IPC::ChannelHandle& channel_handle, 870 const IPC::ChannelHandle& channel_handle,
868 base::ProcessHandle renderer_process_for_gpu, 871 base::ProcessHandle renderer_process_for_gpu,
869 const content::GPUInfo& gpu_info) { 872 const content::GPUInfo& gpu_info) {
870 callback.Run(channel_handle, gpu_info); 873 callback.Run(channel_handle, gpu_info);
871 } 874 }
872 875
873 void GpuProcessHost::CreateCommandBufferError( 876 void GpuProcessHost::CreateCommandBufferError(
874 const CreateCommandBufferCallback& callback, int32 route_id) { 877 const CreateCommandBufferCallback& callback, int32 route_id) {
875 callback.Run(route_id); 878 callback.Run(route_id);
876 } 879 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698