Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) | 216 if (!success) |
| 217 client_ = NULL; | 217 DetachFromClient(); |
|
piman
2016/05/06 19:41:40
this will do the MemoryDumpManager::GetInstance()-
danakj
2016/05/06 20:19:56
Argh OutputSurface. There are a lot of bad options
| |
| 218 | 218 |
| 219 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). | 219 // In certain cases, ThreadTaskRunnerHandle isn't set (Android Webview). |
| 220 // Don't register a dump provider in these cases. | 220 // Don't register a dump provider in these cases. |
| 221 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 | 221 // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 |
| 222 if (client_ && base::ThreadTaskRunnerHandle::IsSet()) { | 222 if (client_ && base::ThreadTaskRunnerHandle::IsSet()) { |
| 223 // Now that we are on the context thread, register a dump provider with this | 223 // 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 | 224 // thread's task runner. This will overwrite any previous dump provider |
| 225 // registered. | 225 // registered. |
| 226 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 226 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 227 this, "OutputSurface", base::ThreadTaskRunnerHandle::Get()); | 227 this, "OutputSurface", base::ThreadTaskRunnerHandle::Get()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 if (context_provider_.get()) { | 361 if (context_provider_.get()) { |
| 362 context_provider_->SetLostContextCallback( | 362 context_provider_->SetLostContextCallback( |
| 363 ContextProvider::LostContextCallback()); | 363 ContextProvider::LostContextCallback()); |
| 364 } | 364 } |
| 365 context_provider_ = nullptr; | 365 context_provider_ = nullptr; |
| 366 client_ = nullptr; | 366 client_ = nullptr; |
| 367 weak_ptr_factory_.InvalidateWeakPtrs(); | 367 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace cc | 370 } // namespace cc |
| OLD | NEW |