Chromium Code Reviews| Index: cc/thread_proxy.cc |
| diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc |
| index f45c09007233e94a82159db7a16c4a6ce5a5d519..0ddb71ee1aa05417cc387a024332cf952fede6ca 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::checkOutputSurfaceStatusOnImplThread, base::Unretained(this))); |
|
jamesr
2012/12/18 21:24:01
this is crashy - there's no promises that the Thre
danakj
2012/12/18 21:26:59
Ok, great plan! Thanks. I'll get to this..
First
|
| +} |
| + |
| +void ThreadProxy::checkOutputSurfaceStatusOnImplThread() |
| +{ |
| + DCHECK(isImplThread()); |
| + TRACE_EVENT0("cc", "ThreadProxy::checkOutputSurfaceStatusOnImplThread"); |
| + 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) |
| + checkOutputSurfaceStatusOnImplThread(); |
| + |
| return result; |
| } |