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

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

Issue 15925007: Virtual context MakeCurrent tweaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: keep explicit surface ref release Created 7 years, 6 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
« no previous file with comments | « no previous file | content/common/gpu/image_transport_surface_mac.cc » ('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) 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // destroy it before those. 351 // destroy it before those.
352 scheduler_.reset(); 352 scheduler_.reset();
353 353
354 bool have_context = false; 354 bool have_context = false;
355 if (decoder_) 355 if (decoder_)
356 have_context = decoder_->MakeCurrent(); 356 have_context = decoder_->MakeCurrent();
357 FOR_EACH_OBSERVER(DestructionObserver, 357 FOR_EACH_OBSERVER(DestructionObserver,
358 destruction_observers_, 358 destruction_observers_,
359 OnWillDestroyStub()); 359 OnWillDestroyStub());
360 360
361 scoped_refptr<gfx::GLContext> context;
362 if (decoder_) { 361 if (decoder_) {
363 context = decoder_->GetGLContext();
364 decoder_->Destroy(have_context); 362 decoder_->Destroy(have_context);
365 decoder_.reset(); 363 decoder_.reset();
366 } 364 }
367 365
368 command_buffer_.reset(); 366 command_buffer_.reset();
369 367
370 // Make sure that context_ is current while we destroy surface_, because 368 // Remove this after crbug.com/248395 is sorted out.
371 // surface_ may have GL resources that it needs to destroy, and will need
372 // context_ to be current in order to not leak these resources.
373 if (context.get())
374 context->MakeCurrent(surface_.get());
375 surface_ = NULL; 369 surface_ = NULL;
376 if (context.get())
377 context->ReleaseCurrent(NULL);
378 } 370 }
379 371
380 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { 372 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) {
381 Destroy(); 373 Destroy();
382 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, false); 374 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, false);
383 Send(reply_message); 375 Send(reply_message);
384 } 376 }
385 377
386 void GpuCommandBufferStub::OnInitialize( 378 void GpuCommandBufferStub::OnInitialize(
387 base::SharedMemoryHandle shared_state_handle, 379 base::SharedMemoryHandle shared_state_handle,
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 if (surface_.get() && MakeCurrent()) 912 if (surface_.get() && MakeCurrent())
921 surface_->SetFrontbufferAllocation( 913 surface_->SetFrontbufferAllocation(
922 allocation.browser_allocation.suggest_have_frontbuffer); 914 allocation.browser_allocation.suggest_have_frontbuffer);
923 } 915 }
924 916
925 last_memory_allocation_valid_ = true; 917 last_memory_allocation_valid_ = true;
926 last_memory_allocation_ = allocation; 918 last_memory_allocation_ = allocation;
927 } 919 }
928 920
929 } // namespace content 921 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/image_transport_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698