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

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

Issue 1115013002: Fix nullptr-deref when command buffer init fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | 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/hash.h" 8 #include "base/hash.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 OnRetireSyncPoint(sync_points_.front()); 422 OnRetireSyncPoint(sync_points_.front());
423 423
424 if (decoder_) 424 if (decoder_)
425 decoder_->set_engine(NULL); 425 decoder_->set_engine(NULL);
426 426
427 // The scheduler has raw references to the decoder and the command buffer so 427 // The scheduler has raw references to the decoder and the command buffer so
428 // destroy it before those. 428 // destroy it before those.
429 scheduler_.reset(); 429 scheduler_.reset();
430 430
431 bool have_context = false; 431 bool have_context = false;
432 if (decoder_) { 432 if (decoder_ && decoder_->GetGLContext()) {
433 // Try to make the context current regardless of whether it was lost, so we 433 // Try to make the context current regardless of whether it was lost, so we
434 // don't leak resources. 434 // don't leak resources.
435 have_context = decoder_->GetGLContext()->MakeCurrent(surface_.get()); 435 have_context = decoder_->GetGLContext()->MakeCurrent(surface_.get());
436 } 436 }
437 FOR_EACH_OBSERVER(DestructionObserver, 437 FOR_EACH_OBSERVER(DestructionObserver,
438 destruction_observers_, 438 destruction_observers_,
439 OnWillDestroyStub()); 439 OnWillDestroyStub());
440 440
441 if (decoder_) { 441 if (decoder_) {
442 decoder_->Destroy(have_context); 442 decoder_->Destroy(have_context);
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); 1112 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info));
1113 } 1113 }
1114 1114
1115 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1115 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1116 base::TimeDelta interval) { 1116 base::TimeDelta interval) {
1117 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1117 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1118 interval)); 1118 interval));
1119 } 1119 }
1120 1120
1121 } // namespace content 1121 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698