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

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

Issue 2559273003: Blink Compositor Animation: Introduce CompositorAnimationHost correctly. (Closed)
Patch Set: Add nullcheck for m_layerTreeView in WebViewImpl Created 4 years 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/loader/FrameLoadRequest.h" 44 #include "core/loader/FrameLoadRequest.h"
45 #include "core/page/FocusController.h" 45 #include "core/page/FocusController.h"
46 #include "core/page/Page.h" 46 #include "core/page/Page.h"
47 #include "core/page/PagePopupClient.h" 47 #include "core/page/PagePopupClient.h"
48 #include "core/page/PagePopupSupplement.h" 48 #include "core/page/PagePopupSupplement.h"
49 #include "modules/accessibility/AXObject.h" 49 #include "modules/accessibility/AXObject.h"
50 #include "modules/accessibility/AXObjectCacheImpl.h" 50 #include "modules/accessibility/AXObjectCacheImpl.h"
51 #include "platform/EventDispatchForbiddenScope.h" 51 #include "platform/EventDispatchForbiddenScope.h"
52 #include "platform/LayoutTestSupport.h" 52 #include "platform/LayoutTestSupport.h"
53 #include "platform/ScriptForbiddenScope.h" 53 #include "platform/ScriptForbiddenScope.h"
54 #include "platform/animation/CompositorAnimationHost.h"
54 #include "platform/heap/Handle.h" 55 #include "platform/heap/Handle.h"
55 #include "platform/tracing/TraceEvent.h" 56 #include "platform/tracing/TraceEvent.h"
56 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h" 57 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
57 #include "public/platform/WebCursorInfo.h" 58 #include "public/platform/WebCursorInfo.h"
58 #include "public/web/WebAXObject.h" 59 #include "public/web/WebAXObject.h"
59 #include "public/web/WebFrameClient.h" 60 #include "public/web/WebFrameClient.h"
60 #include "public/web/WebViewClient.h" 61 #include "public/web/WebViewClient.h"
61 #include "public/web/WebWidgetClient.h" 62 #include "public/web/WebWidgetClient.h"
62 #include "web/WebInputEventConversion.h" 63 #include "web/WebInputEventConversion.h"
63 #include "web/WebLocalFrameImpl.h" 64 #include "web/WebLocalFrameImpl.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (m_popup->isAcceleratedCompositingActive()) { 124 if (m_popup->isAcceleratedCompositingActive()) {
124 DCHECK(m_popup->m_layerTreeView); 125 DCHECK(m_popup->m_layerTreeView);
125 m_popup->m_layerTreeView->setNeedsBeginFrame(); 126 m_popup->m_layerTreeView->setNeedsBeginFrame();
126 return; 127 return;
127 } 128 }
128 m_popup->m_widgetClient->scheduleAnimation(); 129 m_popup->m_widgetClient->scheduleAnimation();
129 } 130 }
130 131
131 void attachCompositorAnimationTimeline(CompositorAnimationTimeline* timeline, 132 void attachCompositorAnimationTimeline(CompositorAnimationTimeline* timeline,
132 LocalFrame*) override { 133 LocalFrame*) override {
133 if (m_popup->m_layerTreeView) 134 if (m_popup->m_compositorAnimationHost)
134 m_popup->m_layerTreeView->attachCompositorAnimationTimeline( 135 m_popup->m_compositorAnimationHost->addTimeline(timeline);
135 timeline->animationTimeline());
136 } 136 }
137 137
138 void detachCompositorAnimationTimeline(CompositorAnimationTimeline* timeline, 138 void detachCompositorAnimationTimeline(CompositorAnimationTimeline* timeline,
139 LocalFrame*) override { 139 LocalFrame*) override {
140 if (m_popup->m_layerTreeView) 140 if (m_popup->m_compositorAnimationHost)
141 m_popup->m_layerTreeView->detachCompositorAnimationTimeline( 141 m_popup->m_compositorAnimationHost->removeTimeline(timeline);
142 timeline->animationTimeline());
143 } 142 }
144 143
145 WebScreenInfo screenInfo() const override { 144 WebScreenInfo screenInfo() const override {
146 return m_popup->m_webView->client() 145 return m_popup->m_webView->client()
147 ? m_popup->m_webView->client()->screenInfo() 146 ? m_popup->m_webView->client()->screenInfo()
148 : WebScreenInfo(); 147 : WebScreenInfo();
149 } 148 }
150 149
151 void* webView() const override { return m_popup->m_webView; } 150 void* webView() const override { return m_popup->m_webView; }
152 151
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 m_isAcceleratedCompositingActive = true; 374 m_isAcceleratedCompositingActive = true;
376 } else { 375 } else {
377 TRACE_EVENT0("blink", 376 TRACE_EVENT0("blink",
378 "WebPagePopupImpl::setIsAcceleratedCompositingActive(true)"); 377 "WebPagePopupImpl::setIsAcceleratedCompositingActive(true)");
379 378
380 m_widgetClient->initializeLayerTreeView(); 379 m_widgetClient->initializeLayerTreeView();
381 m_layerTreeView = m_widgetClient->layerTreeView(); 380 m_layerTreeView = m_widgetClient->layerTreeView();
382 if (m_layerTreeView) { 381 if (m_layerTreeView) {
383 m_layerTreeView->setVisible(true); 382 m_layerTreeView->setVisible(true);
384 m_isAcceleratedCompositingActive = true; 383 m_isAcceleratedCompositingActive = true;
384 m_compositorAnimationHost = WTF::makeUnique<CompositorAnimationHost>(
385 m_layerTreeView->compositorAnimationHost());
385 m_page->layerTreeViewInitialized(*m_layerTreeView); 386 m_page->layerTreeViewInitialized(*m_layerTreeView);
386 } else { 387 } else {
387 m_isAcceleratedCompositingActive = false; 388 m_isAcceleratedCompositingActive = false;
389 m_compositorAnimationHost = nullptr;
388 } 390 }
389 } 391 }
390 } 392 }
391 393
392 void WebPagePopupImpl::beginFrame(double lastFrameTimeMonotonic) { 394 void WebPagePopupImpl::beginFrame(double lastFrameTimeMonotonic) {
393 if (!m_page) 395 if (!m_page)
394 return; 396 return;
395 // FIXME: This should use lastFrameTimeMonotonic but doing so 397 // FIXME: This should use lastFrameTimeMonotonic but doing so
396 // breaks tests. 398 // breaks tests.
397 PageWidgetDelegate::animate(*m_page, monotonicallyIncreasingTime()); 399 PageWidgetDelegate::animate(*m_page, monotonicallyIncreasingTime());
398 } 400 }
399 401
400 void WebPagePopupImpl::willCloseLayerTreeView() { 402 void WebPagePopupImpl::willCloseLayerTreeView() {
401 if (m_page && m_layerTreeView) 403 if (m_page && m_layerTreeView)
402 m_page->willCloseLayerTreeView(*m_layerTreeView); 404 m_page->willCloseLayerTreeView(*m_layerTreeView);
403 405
404 setIsAcceleratedCompositingActive(false); 406 setIsAcceleratedCompositingActive(false);
405 m_layerTreeView = 0; 407 m_layerTreeView = nullptr;
408 m_compositorAnimationHost = nullptr;
406 } 409 }
407 410
408 void WebPagePopupImpl::updateAllLifecyclePhases() { 411 void WebPagePopupImpl::updateAllLifecyclePhases() {
409 if (!m_page) 412 if (!m_page)
410 return; 413 return;
411 PageWidgetDelegate::updateAllLifecyclePhases( 414 PageWidgetDelegate::updateAllLifecyclePhases(
412 *m_page, *m_page->deprecatedLocalMainFrame()); 415 *m_page, *m_page->deprecatedLocalMainFrame());
413 } 416 }
414 417
415 void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect) { 418 void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // A WebPagePopupImpl instance usually has two references. 586 // A WebPagePopupImpl instance usually has two references.
584 // - One owned by the instance itself. It represents the visible widget. 587 // - One owned by the instance itself. It represents the visible widget.
585 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the 588 // - One owned by a WebViewImpl. It's released when the WebViewImpl ask the
586 // WebPagePopupImpl to close. 589 // WebPagePopupImpl to close.
587 // We need them because the closing operation is asynchronous and the widget 590 // We need them because the closing operation is asynchronous and the widget
588 // can be closed while the WebViewImpl is unaware of it. 591 // can be closed while the WebViewImpl is unaware of it.
589 return adoptRef(new WebPagePopupImpl(client)).leakRef(); 592 return adoptRef(new WebPagePopupImpl(client)).leakRef();
590 } 593 }
591 594
592 } // namespace blink 595 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698