Index: third_party/WebKit/Source/web/WebViewImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp |
index dbce5b06b65f7e4ff4ef9e4783670e765bcfada8..ef61bb7cfbd1bd77412a0c00d0547b72190103ac 100644 |
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp |
@@ -33,6 +33,7 @@ |
#include "core/CSSValueKeywords.h" |
#include "core/HTMLNames.h" |
#include "core/InputTypeNames.h" |
+#include "core/animation/CustomCompositorAnimationManager.h" |
#include "core/clipboard/DataObject.h" |
#include "core/dom/Document.h" |
#include "core/dom/Fullscreen.h" |
@@ -106,12 +107,15 @@ |
#include "platform/PlatformKeyboardEvent.h" |
#include "platform/PlatformMouseEvent.h" |
#include "platform/RuntimeEnabledFeatures.h" |
+#include "platform/ThreadSafeFunctional.h" |
#include "platform/TraceEvent.h" |
#include "platform/UserGestureIndicator.h" |
+#include "platform/WaitableEvent.h" |
#include "platform/exported/WebActiveGestureAnimation.h" |
#include "platform/fonts/FontCache.h" |
#include "platform/graphics/Color.h" |
#include "platform/graphics/CompositorFactory.h" |
+#include "platform/graphics/CompositorMutatorClient.h" |
#include "platform/graphics/FirstPaintInvalidationTracking.h" |
#include "platform/graphics/GraphicsContext.h" |
#include "platform/graphics/Image.h" |
@@ -151,6 +155,8 @@ |
#include "public/web/WebViewClient.h" |
#include "public/web/WebWindowFeatures.h" |
#include "web/CompositionUnderlineVectorBuilder.h" |
+#include "web/CompositorMutatorImpl.h" |
+#include "web/CompositorProxyClientImpl.h" |
#include "web/ContextFeaturesClientImpl.h" |
#include "web/ContextMenuAllowedScope.h" |
#include "web/DatabaseClientImpl.h" |
@@ -324,6 +330,14 @@ private: |
WebColor m_color; |
}; |
+void createCompositorMutatorClient(std::unique_ptr<CompositorMutatorClient>* ptr, WaitableEvent* doneEvent) |
+{ |
+ CompositorMutatorImpl* mutator = CompositorMutatorImpl::create(); |
+ ptr->reset(new CompositorMutatorClient(mutator, mutator->animationManager())); |
+ mutator->setClient(ptr->get()); |
+ doneEvent->signal(); |
+} |
+ |
} // namespace |
// WebView ---------------------------------------------------------------- |
@@ -442,6 +456,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) |
, m_shouldDispatchFirstLayoutAfterFinishedLoading(false) |
, m_displayMode(WebDisplayModeBrowser) |
, m_elasticOverscroll(FloatSize()) |
+ , m_mutator(nullptr) |
, m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->createWebViewScheduler(this).release())) |
, m_lastFrameTimeMonotonic(0) |
{ |
@@ -4479,6 +4494,26 @@ void WebViewImpl::forceNextDrawingBufferCreationToFail() |
DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
} |
+CompositorProxyClient* WebViewImpl::createCompositorProxyClient() |
+{ |
+ if (!m_mutator) { |
+ std::unique_ptr<CompositorMutatorClient> mutatorClient; |
+ WaitableEvent doneEvent; |
+ if (WebThread* compositorThread = Platform::current()->compositorThread()) { |
+ compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&createCompositorMutatorClient, AllowCrossThreadAccess(&mutatorClient), AllowCrossThreadAccess(&doneEvent))); |
+ } else { |
+ createCompositorMutatorClient(&mutatorClient, &doneEvent); |
+ } |
+ // TODO(flackr): Instead of waiting for this event, we may be able to just set the |
+ // mutator on the CompositorProxyClient directly from the compositor thread before |
+ // it gets used there. We still need to make sure we only create one mutator though. |
+ doneEvent.wait(); |
+ m_mutator = static_cast<CompositorMutatorImpl*>(mutatorClient->mutator()); |
+ m_layerTreeView->setMutatorClient(std::move(mutatorClient)); |
+ } |
+ return new CompositorProxyClientImpl(m_mutator); |
+} |
+ |
void WebViewImpl::updatePageOverlays() |
{ |
if (m_pageColorOverlay) |