| Index: cc/output/output_surface.cc
|
| diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
|
| index 7a523fea8bdd9d15692c58198d071a25d3759371..b9b945a2e2bf4d0ad754a7537204a3c101b241a5 100644
|
| --- a/cc/output/output_surface.cc
|
| +++ b/cc/output/output_surface.cc
|
| @@ -117,6 +117,7 @@ OutputSurface::OutputSurface(
|
| device_scale_factor_(-1),
|
| external_stencil_test_enabled_(false),
|
| weak_ptr_factory_(this) {
|
| + client_thread_checker_.DetachFromThread();
|
| }
|
|
|
| OutputSurface::OutputSurface(
|
| @@ -191,12 +192,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 {
|
| @@ -204,7 +201,9 @@ bool OutputSurface::HasExternalStencilTest() const {
|
| }
|
|
|
| bool OutputSurface::BindToClient(OutputSurfaceClient* client) {
|
| + DCHECK(client_thread_checker_.CalledOnValidThread());
|
| DCHECK(client);
|
| + DCHECK(!client_);
|
| client_ = client;
|
| bool success = true;
|
|
|
| @@ -218,12 +217,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;
|
|
|
| @@ -241,6 +234,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();
|
|
|