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

Side by Side Diff: third_party/WebKit/Source/core/page/PageAnimator.cpp

Issue 2794803002: Suppress frame requests in InputMethodController::textInputType() (Closed)
Patch Set: InputMethodController::textInputType() Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/page/PageAnimator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/page/PageAnimator.h" 5 #include "core/page/PageAnimator.h"
6 6
7 #include "core/animation/DocumentAnimations.h" 7 #include "core/animation/DocumentAnimations.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/page/ChromeClient.h" 10 #include "core/page/ChromeClient.h"
11 #include "core/page/Page.h" 11 #include "core/page/Page.h"
12 #include "core/svg/SVGDocumentExtensions.h" 12 #include "core/svg/SVGDocumentExtensions.h"
13 #include "platform/instrumentation/tracing/TraceEvent.h" 13 #include "platform/instrumentation/tracing/TraceEvent.h"
14 #include "wtf/AutoReset.h" 14 #include "wtf/AutoReset.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 PageAnimator::PageAnimator(Page& page) 18 PageAnimator::PageAnimator(Page& page) : m_page(page) {}
19 : m_page(page),
20 m_servicingAnimations(false),
21 m_updatingLayoutAndStyleForPainting(false) {}
22 19
23 PageAnimator* PageAnimator::create(Page& page) { 20 PageAnimator* PageAnimator::create(Page& page) {
24 return new PageAnimator(page); 21 return new PageAnimator(page);
25 } 22 }
26 23
27 DEFINE_TRACE(PageAnimator) { 24 DEFINE_TRACE(PageAnimator) {
28 visitor->trace(m_page); 25 visitor->trace(m_page);
29 } 26 }
30 27
31 void PageAnimator::serviceScriptedAnimations( 28 void PageAnimator::serviceScriptedAnimations(
32 double monotonicAnimationStartTime) { 29 double monotonicAnimationStartTime) {
33 AutoReset<bool> servicing(&m_servicingAnimations, true); 30 AutoReset<bool> servicing(&m_servicingAnimations, true);
31 FrameRequestSuppressionScope suppressFrameRequests(this);
32
34 clock().updateTime(monotonicAnimationStartTime); 33 clock().updateTime(monotonicAnimationStartTime);
35 34
36 HeapVector<Member<Document>, 32> documents; 35 HeapVector<Member<Document>, 32> documents;
37 for (Frame* frame = m_page->mainFrame(); frame; 36 for (Frame* frame = m_page->mainFrame(); frame;
38 frame = frame->tree().traverseNext()) { 37 frame = frame->tree().traverseNext()) {
39 if (frame->isLocalFrame()) 38 if (frame->isLocalFrame())
40 documents.push_back(toLocalFrame(frame)->document()); 39 documents.push_back(toLocalFrame(frame)->document());
41 } 40 }
42 41
43 for (auto& document : documents) { 42 for (auto& document : documents) {
(...skipping 24 matching lines...) Expand all
68 } 67 }
69 // TODO(skyostil): This function should not run for documents without views. 68 // TODO(skyostil): This function should not run for documents without views.
70 DocumentLifecycle::DisallowThrottlingScope noThrottlingScope( 69 DocumentLifecycle::DisallowThrottlingScope noThrottlingScope(
71 document->lifecycle()); 70 document->lifecycle());
72 document->serviceScriptedAnimations(monotonicAnimationStartTime); 71 document->serviceScriptedAnimations(monotonicAnimationStartTime);
73 } 72 }
74 } 73 }
75 74
76 DISABLE_CFI_PERF 75 DISABLE_CFI_PERF
77 void PageAnimator::scheduleVisualUpdate(LocalFrame* frame) { 76 void PageAnimator::scheduleVisualUpdate(LocalFrame* frame) {
78 if (m_servicingAnimations || m_updatingLayoutAndStyleForPainting) 77 if (m_frameRequestSuppressionDepth > 0) {
79 return; 78 return;
79 }
80 m_page->chromeClient().scheduleAnimation(frame->view()); 80 m_page->chromeClient().scheduleAnimation(frame->view());
81 } 81 }
82 82
83 void PageAnimator::updateAllLifecyclePhases(LocalFrame& rootFrame) { 83 void PageAnimator::updateAllLifecyclePhases(LocalFrame& rootFrame) {
84 FrameView* view = rootFrame.view(); 84 FrameView* view = rootFrame.view();
85 AutoReset<bool> servicing(&m_updatingLayoutAndStyleForPainting, true); 85 FrameRequestSuppressionScope suppressFrameRequests(this);
86
86 view->updateAllLifecyclePhases(); 87 view->updateAllLifecyclePhases();
87 } 88 }
88 89
90 PageAnimator::FrameRequestSuppressionScope::FrameRequestSuppressionScope(
91 PageAnimator* pageAnimator)
92 : m_pageAnimator(pageAnimator) {
93 if (m_pageAnimator) {
94 m_pageAnimator->m_frameRequestSuppressionDepth++;
95 }
96 }
97
98 PageAnimator::FrameRequestSuppressionScope::~FrameRequestSuppressionScope() {
99 if (m_pageAnimator) {
100 m_pageAnimator->m_frameRequestSuppressionDepth--;
101 }
102 }
103
89 } // namespace blink 104 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/PageAnimator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698