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

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

Issue 16841006: Revert 205481 "Virtual context MakeCurrent tweaks." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | trunk/src/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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // destroy it before those. 352 // destroy it before those.
353 scheduler_.reset(); 353 scheduler_.reset();
354 354
355 bool have_context = false; 355 bool have_context = false;
356 if (decoder_) 356 if (decoder_)
357 have_context = decoder_->MakeCurrent(); 357 have_context = decoder_->MakeCurrent();
358 FOR_EACH_OBSERVER(DestructionObserver, 358 FOR_EACH_OBSERVER(DestructionObserver,
359 destruction_observers_, 359 destruction_observers_,
360 OnWillDestroyStub()); 360 OnWillDestroyStub());
361 361
362 scoped_refptr<gfx::GLContext> context;
362 if (decoder_) { 363 if (decoder_) {
364 context = decoder_->GetGLContext();
363 decoder_->Destroy(have_context); 365 decoder_->Destroy(have_context);
364 decoder_.reset(); 366 decoder_.reset();
365 } 367 }
366 368
367 command_buffer_.reset(); 369 command_buffer_.reset();
368 370
369 // Remove this after crbug.com/248395 is sorted out. 371 // Make sure that context_ is current while we destroy surface_, because
372 // surface_ may have GL resources that it needs to destroy, and will need
373 // context_ to be current in order to not leak these resources.
374 if (context.get())
375 context->MakeCurrent(surface_.get());
370 surface_ = NULL; 376 surface_ = NULL;
377 if (context.get())
378 context->ReleaseCurrent(NULL);
371 } 379 }
372 380
373 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { 381 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) {
374 Destroy(); 382 Destroy();
375 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, false); 383 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, false);
376 Send(reply_message); 384 Send(reply_message);
377 } 385 }
378 386
379 void GpuCommandBufferStub::OnInitialize( 387 void GpuCommandBufferStub::OnInitialize(
380 base::SharedMemoryHandle shared_state_handle, 388 base::SharedMemoryHandle shared_state_handle,
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 if (surface_.get() && MakeCurrent()) 911 if (surface_.get() && MakeCurrent())
904 surface_->SetFrontbufferAllocation( 912 surface_->SetFrontbufferAllocation(
905 allocation.browser_allocation.suggest_have_frontbuffer); 913 allocation.browser_allocation.suggest_have_frontbuffer);
906 } 914 }
907 915
908 last_memory_allocation_valid_ = true; 916 last_memory_allocation_valid_ = true;
909 last_memory_allocation_ = allocation; 917 last_memory_allocation_ = allocation;
910 } 918 }
911 919
912 } // namespace content 920 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | trunk/src/content/common/gpu/image_transport_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698