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

Unified Diff: cc/output/output_surface.cc

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayerTreeHostClientTakeAwayOutputSurface test. Content provider is always destroyed on the clie… Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/raster/tile_task_worker_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/output_surface.cc
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index 5014fc06c8885a4d8e958c82a395bef3e2413be1..d0300fe10285e7db1eeb93fee429215e601f4afb 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -120,6 +120,7 @@ OutputSurface::OutputSurface(
device_scale_factor_(-1),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this) {
+ client_thread_checker_.DetachFromThread();
}
OutputSurface::OutputSurface(
@@ -194,12 +195,8 @@ OutputSurface::~OutputSurface() {
base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
this);
- if (context_provider_.get()) {
- context_provider_->SetLostContextCallback(
- ContextProvider::LostContextCallback());
- context_provider_->SetMemoryPolicyChangedCallback(
- ContextProvider::MemoryPolicyChangedCallback());
- }
+ if (client_)
+ DetachFromClient();
}
bool OutputSurface::HasExternalStencilTest() const {
@@ -207,7 +204,9 @@ bool OutputSurface::HasExternalStencilTest() const {
}
bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
+ DCHECK(client_thread_checker_.CalledOnValidThread());
DCHECK(client);
+ DCHECK(!client_);
client_ = client;
bool success = true;
@@ -221,12 +220,6 @@ bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
}
}
- if (success && worker_context_provider_.get()) {
- success = worker_context_provider_->BindToCurrentThread();
- if (success)
- worker_context_provider_->SetupLock();
- }
-
if (!success)
client_ = NULL;
@@ -244,6 +237,20 @@ bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
return success;
}
+void OutputSurface::DetachFromClient() {
+ DCHECK(client_thread_checker_.CalledOnValidThread());
+ DCHECK(client_);
+ if (context_provider_.get()) {
+ context_provider_->SetLostContextCallback(
+ ContextProvider::LostContextCallback());
+ context_provider_->SetMemoryPolicyChangedCallback(
+ ContextProvider::MemoryPolicyChangedCallback());
+ }
+ context_provider_ = nullptr;
+ client_ = nullptr;
+ weak_ptr_factory_.InvalidateWeakPtrs();
+}
+
void OutputSurface::EnsureBackbuffer() {
if (software_device_)
software_device_->EnsureBackbuffer();
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/raster/tile_task_worker_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698