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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 10984004: Use a singleton 1x1 offscreen surface for all TextureImageTransportSurface instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor polish - consistently use the get() accessor. Created 8 years, 2 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 | Annotate | Revision Log
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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 OnInitializeFailed(reply_message); 364 OnInitializeFailed(reply_message);
365 return; 365 return;
366 } 366 }
367 #endif 367 #endif
368 368
369 surface_ = ImageTransportSurface::CreateSurface( 369 surface_ = ImageTransportSurface::CreateSurface(
370 channel_->gpu_channel_manager(), 370 channel_->gpu_channel_manager(),
371 this, 371 this,
372 handle_); 372 handle_);
373 } else { 373 } else {
374 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(software_, 374 GpuChannelManager* manager = channel_->gpu_channel_manager();
375 gfx::Size(1, 1)); 375 surface_ = manager->GetDefaultOffscreenSurface();
376 } 376 }
377 377
378 if (!surface_.get()) { 378 if (!surface_.get()) {
379 // Ensure the decoder is not destroyed if it is not initialized. 379 // Ensure the decoder is not destroyed if it is not initialized.
380 decoder_.reset(); 380 decoder_.reset();
381 381
382 DLOG(ERROR) << "Failed to create surface.\n"; 382 DLOG(ERROR) << "Failed to create surface.\n";
383 OnInitializeFailed(reply_message); 383 OnInitializeFailed(reply_message);
384 return; 384 return;
385 } 385 }
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 const GpuMemoryAllocation& allocation) { 831 const GpuMemoryAllocation& allocation) {
832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); 832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation));
833 // This can be called outside of OnMessageReceived, so the context needs to be 833 // This can be called outside of OnMessageReceived, so the context needs to be
834 // made current before calling methods on the surface. 834 // made current before calling methods on the surface.
835 if (!surface_ || !MakeCurrent()) 835 if (!surface_ || !MakeCurrent())
836 return; 836 return;
837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); 837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer);
838 } 838 }
839 839
840 #endif // defined(ENABLE_GPU) 840 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_manager.cc ('k') | content/common/gpu/texture_image_transport_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698