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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.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) 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 #include "modules/webgl/WebGLRenderingContext.h" 95 #include "modules/webgl/WebGLRenderingContext.h"
96 #include "platform/ContextMenu.h" 96 #include "platform/ContextMenu.h"
97 #include "platform/ContextMenuItem.h" 97 #include "platform/ContextMenuItem.h"
98 #include "platform/Cursor.h" 98 #include "platform/Cursor.h"
99 #include "platform/Histogram.h" 99 #include "platform/Histogram.h"
100 #include "platform/KeyboardCodes.h" 100 #include "platform/KeyboardCodes.h"
101 #include "platform/PlatformGestureEvent.h" 101 #include "platform/PlatformGestureEvent.h"
102 #include "platform/PlatformMouseEvent.h" 102 #include "platform/PlatformMouseEvent.h"
103 #include "platform/RuntimeEnabledFeatures.h" 103 #include "platform/RuntimeEnabledFeatures.h"
104 #include "platform/UserGestureIndicator.h" 104 #include "platform/UserGestureIndicator.h"
105 #include "platform/animation/CompositorAnimationHost.h"
105 #include "platform/exported/WebActiveGestureAnimation.h" 106 #include "platform/exported/WebActiveGestureAnimation.h"
106 #include "platform/fonts/FontCache.h" 107 #include "platform/fonts/FontCache.h"
107 #include "platform/geometry/FloatRect.h" 108 #include "platform/geometry/FloatRect.h"
108 #include "platform/graphics/Color.h" 109 #include "platform/graphics/Color.h"
109 #include "platform/graphics/CompositorMutatorClient.h" 110 #include "platform/graphics/CompositorMutatorClient.h"
110 #include "platform/graphics/FirstPaintInvalidationTracking.h" 111 #include "platform/graphics/FirstPaintInvalidationTracking.h"
111 #include "platform/graphics/GraphicsContext.h" 112 #include "platform/graphics/GraphicsContext.h"
112 #include "platform/graphics/Image.h" 113 #include "platform/graphics/Image.h"
113 #include "platform/graphics/ImageBuffer.h" 114 #include "platform/graphics/ImageBuffer.h"
114 #include "platform/graphics/gpu/DrawingBuffer.h" 115 #include "platform/graphics/gpu/DrawingBuffer.h"
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 if (m_linkHighlightsTimeline) { 2522 if (m_linkHighlightsTimeline) {
2522 m_linkHighlights.clear(); 2523 m_linkHighlights.clear();
2523 detachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); 2524 detachCompositorAnimationTimeline(m_linkHighlightsTimeline.get());
2524 m_linkHighlightsTimeline.reset(); 2525 m_linkHighlightsTimeline.reset();
2525 } 2526 }
2526 2527
2527 if (m_layerTreeView) 2528 if (m_layerTreeView)
2528 page()->willCloseLayerTreeView(*m_layerTreeView); 2529 page()->willCloseLayerTreeView(*m_layerTreeView);
2529 2530
2530 setRootLayer(nullptr); 2531 setRootLayer(nullptr);
2532 m_compositorAnimationHost = nullptr;
2531 2533
2532 m_mutator = nullptr; 2534 m_mutator = nullptr;
2533 m_layerTreeView = nullptr; 2535 m_layerTreeView = nullptr;
2534 } 2536 }
2535 2537
2536 void WebViewImpl::didAcquirePointerLock() { 2538 void WebViewImpl::didAcquirePointerLock() {
2537 if (page()) 2539 if (page())
2538 page()->pointerLockController().didAcquirePointerLock(); 2540 page()->pointerLockController().didAcquirePointerLock();
2539 } 2541 }
2540 2542
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
3939 if (m_layerTreeView) { 3941 if (m_layerTreeView) {
3940 m_layerTreeView->setNeedsBeginFrame(); 3942 m_layerTreeView->setNeedsBeginFrame();
3941 return; 3943 return;
3942 } 3944 }
3943 if (m_client) 3945 if (m_client)
3944 m_client->widgetClient()->scheduleAnimation(); 3946 m_client->widgetClient()->scheduleAnimation();
3945 } 3947 }
3946 3948
3947 void WebViewImpl::attachCompositorAnimationTimeline( 3949 void WebViewImpl::attachCompositorAnimationTimeline(
3948 CompositorAnimationTimeline* timeline) { 3950 CompositorAnimationTimeline* timeline) {
3949 if (m_layerTreeView) 3951 if (m_compositorAnimationHost)
3950 m_layerTreeView->attachCompositorAnimationTimeline( 3952 m_compositorAnimationHost->addTimeline(timeline);
3951 timeline->animationTimeline());
3952 } 3953 }
3953 3954
3954 void WebViewImpl::detachCompositorAnimationTimeline( 3955 void WebViewImpl::detachCompositorAnimationTimeline(
3955 CompositorAnimationTimeline* timeline) { 3956 CompositorAnimationTimeline* timeline) {
3956 if (m_layerTreeView) 3957 if (m_compositorAnimationHost)
3957 m_layerTreeView->detachCompositorAnimationTimeline( 3958 m_compositorAnimationHost->removeTimeline(timeline);
3958 timeline->animationTimeline());
3959 } 3959 }
3960 3960
3961 void WebViewImpl::initializeLayerTreeView() { 3961 void WebViewImpl::initializeLayerTreeView() {
3962 if (m_client) { 3962 if (m_client) {
3963 m_client->initializeLayerTreeView(); 3963 m_client->initializeLayerTreeView();
3964 m_layerTreeView = m_client->widgetClient()->layerTreeView(); 3964 m_layerTreeView = m_client->widgetClient()->layerTreeView();
3965 if (m_layerTreeView && m_layerTreeView->compositorAnimationHost()) {
3966 m_compositorAnimationHost = WTF::makeUnique<CompositorAnimationHost>(
3967 m_layerTreeView->compositorAnimationHost());
3968 }
3965 } 3969 }
3966 3970
3967 if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl()) 3971 if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl())
3968 devTools->layerTreeViewChanged(m_layerTreeView); 3972 devTools->layerTreeViewChanged(m_layerTreeView);
3969 3973
3970 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView); 3974 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView);
3971 if (m_layerTreeView) 3975 if (m_layerTreeView)
3972 m_page->layerTreeViewInitialized(*m_layerTreeView); 3976 m_page->layerTreeViewInitialized(*m_layerTreeView);
3973 3977
3974 // FIXME: only unittests, click to play, Android printing, and printing (for 3978 // FIXME: only unittests, click to play, Android printing, and printing (for
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4204 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4208 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4205 return nullptr; 4209 return nullptr;
4206 return focusedFrame; 4210 return focusedFrame;
4207 } 4211 }
4208 4212
4209 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4213 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4210 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4214 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4211 } 4215 }
4212 4216
4213 } // namespace blink 4217 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698