Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1895873006: compositor-worker: Initialize CW machinery plumbing to compositor and fire CW rAF callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring up oilpan support during compositor worker creation and oilpan the compositor mutator and pro… Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/WebViewImpl.h" 31 #include "web/WebViewImpl.h"
32 32
33 #include "core/CSSValueKeywords.h" 33 #include "core/CSSValueKeywords.h"
34 #include "core/HTMLNames.h" 34 #include "core/HTMLNames.h"
35 #include "core/InputTypeNames.h" 35 #include "core/InputTypeNames.h"
36 #include "core/animation/CustomCompositorAnimationManager.h"
36 #include "core/clipboard/DataObject.h" 37 #include "core/clipboard/DataObject.h"
37 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
38 #include "core/dom/Fullscreen.h" 39 #include "core/dom/Fullscreen.h"
39 #include "core/dom/LayoutTreeBuilderTraversal.h" 40 #include "core/dom/LayoutTreeBuilderTraversal.h"
40 #include "core/dom/Text.h" 41 #include "core/dom/Text.h"
41 #include "core/editing/EditingUtilities.h" 42 #include "core/editing/EditingUtilities.h"
42 #include "core/editing/Editor.h" 43 #include "core/editing/Editor.h"
43 #include "core/editing/FrameSelection.h" 44 #include "core/editing/FrameSelection.h"
44 #include "core/editing/InputMethodController.h" 45 #include "core/editing/InputMethodController.h"
45 #include "core/editing/iterators/TextIterator.h" 46 #include "core/editing/iterators/TextIterator.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 #include "platform/ContextMenu.h" 101 #include "platform/ContextMenu.h"
101 #include "platform/ContextMenuItem.h" 102 #include "platform/ContextMenuItem.h"
102 #include "platform/Cursor.h" 103 #include "platform/Cursor.h"
103 #include "platform/Histogram.h" 104 #include "platform/Histogram.h"
104 #include "platform/KeyboardCodes.h" 105 #include "platform/KeyboardCodes.h"
105 #include "platform/Logging.h" 106 #include "platform/Logging.h"
106 #include "platform/PlatformGestureEvent.h" 107 #include "platform/PlatformGestureEvent.h"
107 #include "platform/PlatformKeyboardEvent.h" 108 #include "platform/PlatformKeyboardEvent.h"
108 #include "platform/PlatformMouseEvent.h" 109 #include "platform/PlatformMouseEvent.h"
109 #include "platform/RuntimeEnabledFeatures.h" 110 #include "platform/RuntimeEnabledFeatures.h"
111 #include "platform/ThreadSafeFunctional.h"
110 #include "platform/TraceEvent.h" 112 #include "platform/TraceEvent.h"
111 #include "platform/UserGestureIndicator.h" 113 #include "platform/UserGestureIndicator.h"
114 #include "platform/WaitableEvent.h"
112 #include "platform/exported/WebActiveGestureAnimation.h" 115 #include "platform/exported/WebActiveGestureAnimation.h"
113 #include "platform/fonts/FontCache.h" 116 #include "platform/fonts/FontCache.h"
114 #include "platform/graphics/Color.h" 117 #include "platform/graphics/Color.h"
115 #include "platform/graphics/CompositorFactory.h" 118 #include "platform/graphics/CompositorFactory.h"
119 #include "platform/graphics/CompositorMutatorClient.h"
116 #include "platform/graphics/FirstPaintInvalidationTracking.h" 120 #include "platform/graphics/FirstPaintInvalidationTracking.h"
117 #include "platform/graphics/GraphicsContext.h" 121 #include "platform/graphics/GraphicsContext.h"
118 #include "platform/graphics/Image.h" 122 #include "platform/graphics/Image.h"
119 #include "platform/graphics/ImageBuffer.h" 123 #include "platform/graphics/ImageBuffer.h"
120 #include "platform/graphics/gpu/DrawingBuffer.h" 124 #include "platform/graphics/gpu/DrawingBuffer.h"
121 #include "platform/graphics/paint/DrawingRecorder.h" 125 #include "platform/graphics/paint/DrawingRecorder.h"
122 #include "platform/scroll/ScrollbarTheme.h" 126 #include "platform/scroll/ScrollbarTheme.h"
123 #include "platform/weborigin/SchemeRegistry.h" 127 #include "platform/weborigin/SchemeRegistry.h"
124 #include "public/platform/Platform.h" 128 #include "public/platform/Platform.h"
125 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" 129 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
(...skipping 19 matching lines...) Expand all
145 #include "public/web/WebMediaPlayerAction.h" 149 #include "public/web/WebMediaPlayerAction.h"
146 #include "public/web/WebNode.h" 150 #include "public/web/WebNode.h"
147 #include "public/web/WebPlugin.h" 151 #include "public/web/WebPlugin.h"
148 #include "public/web/WebPluginAction.h" 152 #include "public/web/WebPluginAction.h"
149 #include "public/web/WebRange.h" 153 #include "public/web/WebRange.h"
150 #include "public/web/WebSelection.h" 154 #include "public/web/WebSelection.h"
151 #include "public/web/WebTextInputInfo.h" 155 #include "public/web/WebTextInputInfo.h"
152 #include "public/web/WebViewClient.h" 156 #include "public/web/WebViewClient.h"
153 #include "public/web/WebWindowFeatures.h" 157 #include "public/web/WebWindowFeatures.h"
154 #include "web/CompositionUnderlineVectorBuilder.h" 158 #include "web/CompositionUnderlineVectorBuilder.h"
159 #include "web/CompositorMutatorImpl.h"
160 #include "web/CompositorProxyClientImpl.h"
155 #include "web/ContextFeaturesClientImpl.h" 161 #include "web/ContextFeaturesClientImpl.h"
156 #include "web/ContextMenuAllowedScope.h" 162 #include "web/ContextMenuAllowedScope.h"
157 #include "web/DatabaseClientImpl.h" 163 #include "web/DatabaseClientImpl.h"
158 #include "web/DevToolsEmulator.h" 164 #include "web/DevToolsEmulator.h"
159 #include "web/FullscreenController.h" 165 #include "web/FullscreenController.h"
160 #include "web/InspectorOverlay.h" 166 #include "web/InspectorOverlay.h"
161 #include "web/LinkHighlightImpl.h" 167 #include "web/LinkHighlightImpl.h"
162 #include "web/PageOverlay.h" 168 #include "web/PageOverlay.h"
163 #include "web/PrerendererClientImpl.h" 169 #include "web/PrerendererClientImpl.h"
164 #include "web/ResizeViewportAnchor.h" 170 #include "web/ResizeViewportAnchor.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 , m_showFPSCounter(false) 442 , m_showFPSCounter(false)
437 , m_baseBackgroundColor(Color::white) 443 , m_baseBackgroundColor(Color::white)
438 , m_backgroundColorOverride(Color::transparent) 444 , m_backgroundColorOverride(Color::transparent)
439 , m_zoomFactorOverride(0) 445 , m_zoomFactorOverride(0)
440 , m_userGestureObserved(false) 446 , m_userGestureObserved(false)
441 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) 447 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false)
442 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) 448 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false)
443 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) 449 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false)
444 , m_displayMode(WebDisplayModeBrowser) 450 , m_displayMode(WebDisplayModeBrowser)
445 , m_elasticOverscroll(FloatSize()) 451 , m_elasticOverscroll(FloatSize())
452 , m_mutator(nullptr)
446 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr eateWebViewScheduler(this).release())) 453 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr eateWebViewScheduler(this).release()))
447 { 454 {
448 Page::PageClients pageClients; 455 Page::PageClients pageClients;
449 pageClients.chromeClient = m_chromeClientImpl.get(); 456 pageClients.chromeClient = m_chromeClientImpl.get();
450 pageClients.contextMenuClient = &m_contextMenuClientImpl; 457 pageClients.contextMenuClient = &m_contextMenuClientImpl;
451 pageClients.editorClient = &m_editorClientImpl; 458 pageClients.editorClient = &m_editorClientImpl;
452 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; 459 pageClients.spellCheckerClient = &m_spellCheckerClientImpl;
453 460
454 m_page = Page::createOrdinary(pageClients); 461 m_page = Page::createOrdinary(pageClients);
455 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); 462 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl);
(...skipping 4082 matching lines...) Expand 10 before | Expand all | Expand 10 after
4538 void WebViewImpl::forceNextWebGLContextCreationToFail() 4545 void WebViewImpl::forceNextWebGLContextCreationToFail()
4539 { 4546 {
4540 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4547 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4541 } 4548 }
4542 4549
4543 void WebViewImpl::forceNextDrawingBufferCreationToFail() 4550 void WebViewImpl::forceNextDrawingBufferCreationToFail()
4544 { 4551 {
4545 DrawingBuffer::forceNextDrawingBufferCreationToFail(); 4552 DrawingBuffer::forceNextDrawingBufferCreationToFail();
4546 } 4553 }
4547 4554
4555 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.
4556 {
4557 CompositorMutatorImpl* mutator = CompositorMutatorImpl::create();
4558 *ptr = new CompositorMutatorClient(mutator, mutator->animationManager());
4559 mutator->setClient(*ptr);
4560 doneEvent->signal();
4561 }
4562
4563 CompositorProxyClient* WebViewImpl::createCompositorProxyClient(double reference MonotonicTime)
4564 {
4565 if (!m_mutator) {
4566 std::unique_ptr<CompositorMutatorClient> mutatorClient;
4567 CompositorMutatorClient* client;
4568 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();
4569 WebThread* compositorThread = Platform::current()->compositorThread();
4570 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.
4571 compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, thre adSafeBind(&createCompositoMutatorClient, AllowCrossThreadAccess(&client), Allow CrossThreadAccess(doneEvent.get())));
4572 } else {
4573 createCompositoMutatorClient(&client, doneEvent.get());
4574 }
4575 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.
4576 mutatorClient.reset(client);
4577 m_mutator = static_cast<CompositorMutatorImpl*>(mutatorClient->mutator() );
4578 m_layerTreeView->setMutatorClient(std::move(mutatorClient));
4579 }
4580 return new CompositorProxyClientImpl(m_mutator, referenceMonotonicTime);
4581 }
4582
4548 void WebViewImpl::updatePageOverlays() 4583 void WebViewImpl::updatePageOverlays()
4549 { 4584 {
4550 if (m_pageColorOverlay) 4585 if (m_pageColorOverlay)
4551 m_pageColorOverlay->update(); 4586 m_pageColorOverlay->update();
4552 if (InspectorOverlay* overlay = inspectorOverlay()) { 4587 if (InspectorOverlay* overlay = inspectorOverlay()) {
4553 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); 4588 PageOverlay* inspectorPageOverlay = overlay->pageOverlay();
4554 if (inspectorPageOverlay) 4589 if (inspectorPageOverlay)
4555 inspectorPageOverlay->update(); 4590 inspectorPageOverlay->update();
4556 } 4591 }
4557 } 4592 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4590 { 4625 {
4591 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4626 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4592 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4627 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4593 if (!page()) 4628 if (!page())
4594 return 1; 4629 return 1;
4595 4630
4596 return page()->deviceScaleFactor(); 4631 return page()->deviceScaleFactor();
4597 } 4632 }
4598 4633
4599 } // namespace blink 4634 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698