 Chromium Code Reviews
 Chromium Code Reviews Issue 11606012:
  cc: Unify context losing machinery  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 11606012:
  cc: Unify context losing machinery  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: cc/thread_proxy.cc | 
| diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc | 
| index f45c09007233e94a82159db7a16c4a6ce5a5d519..d710702bedd05c34a657c4455a28a81b09087704 100644 | 
| --- a/cc/thread_proxy.cc | 
| +++ b/cc/thread_proxy.cc | 
| @@ -12,10 +12,12 @@ | 
| #include "cc/input_handler.h" | 
| #include "cc/layer_tree_host.h" | 
| #include "cc/output_surface.h" | 
| +#include "cc/resource_provider.h" | 
| #include "cc/scheduler.h" | 
| #include "cc/scoped_thread_proxy.h" | 
| #include "cc/thread.h" | 
| -#include <public/WebSharedGraphicsContext3D.h> | 
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" | 
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebSharedGraphicsContext3D.h" | 
| using WebKit::WebSharedGraphicsContext3D; | 
| @@ -265,7 +267,14 @@ const RendererCapabilities& ThreadProxy::rendererCapabilities() const | 
| void ThreadProxy::loseOutputSurface() | 
| { | 
| - Proxy::implThread()->postTask(base::Bind(&ThreadProxy::didLoseOutputSurfaceOnImplThread, base::Unretained(this))); | 
| + DCHECK(isMainThread()); | 
| + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::loseOutputSurfaceOnImplThread, base::Unretained(this))); | 
| +} | 
| + | 
| +void ThreadProxy::loseOutputSurfaceOnImplThread() | 
| +{ | 
| + DCHECK(isImplThread()); | 
| + m_layerTreeHostImpl->resourceProvider()->loseOutputSurface(); | 
| } | 
| void ThreadProxy::setNeedsAnimate() | 
| @@ -301,6 +310,15 @@ void ThreadProxy::didLoseOutputSurfaceOnImplThread() | 
| { | 
| DCHECK(isImplThread()); | 
| TRACE_EVENT0("cc", "ThreadProxy::didLoseOutputSurfaceOnImplThread"); | 
| + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::checkLostOutputSurfaceOnImplThread, base::Unretained(this))); | 
| 
jamesr
2012/12/18 05:44:41
hmmm - how is this base::Unretained(this) safe? i.
 | 
| +} | 
| + | 
| +void ThreadProxy::checkLostOutputSurfaceOnImplThread() | 
| +{ | 
| + DCHECK(isImplThread()); | 
| + TRACE_EVENT0("cc", "ThreadProxy::checkLostContextOnImplThread"); | 
| + if (!m_layerTreeHostImpl->isContextLost()) | 
| + return; | 
| m_schedulerOnImplThread->didLoseOutputSurface(); | 
| } | 
| @@ -780,6 +798,9 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal | 
| m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadProxy::didCommitAndDrawFrame, base::Unretained(this))); | 
| } | 
| + if (drawFrame) | 
| + checkLostOutputSurfaceOnImplThread(); | 
| + | 
| return result; | 
| } |