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

Side by Side Diff: cc/output/output_surface.cc

Issue 1949753007: Detach the output surface if bind fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: detach: . Created 4 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 | content/renderer/gpu/compositor_output_surface.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 bool success = true; 206 bool success = true;
207 207
208 if (context_provider_.get()) { 208 if (context_provider_.get()) {
209 success = context_provider_->BindToCurrentThread(); 209 success = context_provider_->BindToCurrentThread();
210 if (success) { 210 if (success) {
211 context_provider_->SetLostContextCallback(base::Bind( 211 context_provider_->SetLostContextCallback(base::Bind(
212 &OutputSurface::DidLoseOutputSurface, base::Unretained(this))); 212 &OutputSurface::DidLoseOutputSurface, base::Unretained(this)));
213 } 213 }
214 } 214 }
215 215
216 if (!success)
217 client_ = NULL;
218
219 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). 216 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview).
220 // Don't register a dump provider in these cases. 217 // Don't register a dump provider in these cases.
221 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 218 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156
222 if (client_ && base::ThreadTaskRunnerHandle::IsSet()) { 219 if (base::ThreadTaskRunnerHandle::IsSet()) {
223 // Now that we are on the context thread, register a dump provider with this 220 // Now that we are on the context thread, register a dump provider with this
224 // thread's task runner. This will overwrite any previous dump provider 221 // thread's task runner. This will overwrite any previous dump provider
225 // registered. 222 // registered.
226 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 223 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
227 this, "OutputSurface", base::ThreadTaskRunnerHandle::Get()); 224 this, "OutputSurface", base::ThreadTaskRunnerHandle::Get());
228 } 225 }
229 226
227 if (!success)
228 DetachFromClient();
230 return success; 229 return success;
231 } 230 }
232 231
233 void OutputSurface::DetachFromClient() { 232 void OutputSurface::DetachFromClient() {
234 DetachFromClientInternal(); 233 DetachFromClientInternal();
235 } 234 }
236 235
237 void OutputSurface::EnsureBackbuffer() { 236 void OutputSurface::EnsureBackbuffer() {
238 if (software_device_) 237 if (software_device_)
239 software_device_->EnsureBackbuffer(); 238 software_device_->EnsureBackbuffer();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 if (context_provider_.get()) { 360 if (context_provider_.get()) {
362 context_provider_->SetLostContextCallback( 361 context_provider_->SetLostContextCallback(
363 ContextProvider::LostContextCallback()); 362 ContextProvider::LostContextCallback());
364 } 363 }
365 context_provider_ = nullptr; 364 context_provider_ = nullptr;
366 client_ = nullptr; 365 client_ = nullptr;
367 weak_ptr_factory_.InvalidateWeakPtrs(); 366 weak_ptr_factory_.InvalidateWeakPtrs();
368 } 367 }
369 368
370 } // namespace cc 369 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698