Chromium Code Reviews| 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 358c045533e74111a3bb3a10c57126db939e78cf..f9de83406b7f66453a2f5973a7bf2de182e5c71d 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" |
| @@ -107,12 +108,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" |
| @@ -152,6 +156,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" |
| @@ -443,6 +449,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())) |
| { |
| Page::PageClients pageClients; |
| @@ -4545,6 +4552,34 @@ void WebViewImpl::forceNextDrawingBufferCreationToFail() |
| DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
| } |
| +void createCompositoMutatorClient(CompositorMutatorClient** ptr, WaitableEvent* doneEvent) |
|
jbroman
2016/04/29 19:42:23
nit/spelling: "createCompositorMutatorClient"
Als
flackr
2016/05/03 22:24:55
Done.
|
| +{ |
| + CompositorMutatorImpl* mutator = CompositorMutatorImpl::create(); |
| + *ptr = new CompositorMutatorClient(mutator, mutator->animationManager()); |
| + mutator->setClient(*ptr); |
| + doneEvent->signal(); |
| +} |
| + |
| +CompositorProxyClient* WebViewImpl::createCompositorProxyClient(double referenceMonotonicTime) |
| +{ |
| + if (!m_mutator) { |
| + std::unique_ptr<CompositorMutatorClient> mutatorClient; |
| + CompositorMutatorClient* client; |
| + OwnPtr<WaitableEvent> doneEvent = adoptPtr(new WaitableEvent()); |
|
jbroman
2016/04/29 19:42:22
No need for an extra layer of heap allocation here
flackr
2016/05/03 22:24:55
Done, or should i say doneEvent.signal();
|
| + WebThread* compositorThread = Platform::current()->compositorThread(); |
| + if (compositorThread) { |
|
jbroman
2016/04/29 19:42:22
super-nit: you can combine these two lines:
if (W
flackr
2016/05/03 22:24:55
Done.
|
| + compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSafeBind(&createCompositoMutatorClient, AllowCrossThreadAccess(&client), AllowCrossThreadAccess(doneEvent.get()))); |
| + } else { |
| + createCompositoMutatorClient(&client, doneEvent.get()); |
| + } |
| + doneEvent->wait(); |
|
jbroman
2016/04/29 19:42:22
I'm not thrilled about blocking between threads, b
flackr
2016/05/03 22:24:55
Agreed, but we also need to make sure we only crea
jbroman
2016/05/04 17:59:00
Yeah, I'm happy with that resolution.
|
| + mutatorClient.reset(client); |
| + m_mutator = static_cast<CompositorMutatorImpl*>(mutatorClient->mutator()); |
| + m_layerTreeView->setMutatorClient(std::move(mutatorClient)); |
| + } |
| + return new CompositorProxyClientImpl(m_mutator, referenceMonotonicTime); |
| +} |
| + |
| void WebViewImpl::updatePageOverlays() |
| { |
| if (m_pageColorOverlay) |