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

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

Issue 1300043003: Centralize deferred commit conditions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebViewImpl.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 /* 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 3898 matching lines...) Expand 10 before | Expand all | Expand 10 after
3909 page()->frameHost().visualViewport().mainFrameDidChangeSize(); 3909 page()->frameHost().visualViewport().mainFrameDidChangeSize();
3910 3910
3911 // Make sure link highlight from previous page is cleared. 3911 // Make sure link highlight from previous page is cleared.
3912 m_linkHighlights.clear(); 3912 m_linkHighlights.clear();
3913 endActiveFlingAnimation(); 3913 endActiveFlingAnimation();
3914 m_userGestureObserved = false; 3914 m_userGestureObserved = false;
3915 } 3915 }
3916 3916
3917 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe) 3917 void WebViewImpl::willInsertBody(WebLocalFrameImpl* webframe)
3918 { 3918 {
3919 if (webframe != mainFrameImpl()) 3919 resumeTreeViewCommitsIfNeeded(webframe);
3920 return;
3921
3922 if (!m_page->mainFrame()->isLocalFrame())
3923 return;
3924
3925 // If we get to the <body> tag and we have no pending stylesheet and import load, we
3926 // can be fairly confident we'll have something sensible to paint soon and
3927 // can turn off deferred commits.
3928 if (m_page->deprecatedLocalMainFrame()->document()->isRenderingReady())
3929 resumeTreeViewCommits();
3930 } 3920 }
3931 3921
3932 void WebViewImpl::didFinishDocumentLoad(WebLocalFrameImpl* webframe) 3922 void WebViewImpl::didFinishDocumentLoad(WebLocalFrameImpl* webframe)
3933 { 3923 {
3934 if (webframe != mainFrameImpl()) 3924 resumeTreeViewCommitsIfNeeded(webframe);
3935 return;
3936 // If we finished parsing and there's no sheets to load start painting.
3937 if (webframe->frame()->document()->isRenderingReady())
3938 resumeTreeViewCommits();
3939 } 3925 }
3940 3926
3941 void WebViewImpl::didRemoveAllPendingStylesheet(WebLocalFrameImpl* webframe) 3927 void WebViewImpl::didRemoveAllPendingStylesheet(WebLocalFrameImpl* webframe)
3942 { 3928 {
3929 resumeTreeViewCommitsIfNeeded(webframe);
3930 }
3931
3932 void WebViewImpl::resumeTreeViewCommitsIfNeeded(WebLocalFrameImpl* webframe)
3933 {
3943 if (webframe != mainFrameImpl()) 3934 if (webframe != mainFrameImpl())
3944 return; 3935 return;
3945 3936 if (!webframe->frame()->document()->shouldProcessFrameLifecycle())
3946 // If we have no more stylesheets to load and we're past the body tag, 3937 return;
3947 // we should have something to paint and should start as soon as possible. 3938 if (!m_layerTreeView)
3948 if (m_page->deprecatedLocalMainFrame()->document()->body()) 3939 return;
3949 resumeTreeViewCommits(); 3940 m_layerTreeView->setDeferCommits(false);
3950 }
3951
3952 void WebViewImpl::resumeTreeViewCommits()
3953 {
3954 if (m_layerTreeView)
3955 m_layerTreeView->setDeferCommits(false);
3956 } 3941 }
3957 3942
3958 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) 3943 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe)
3959 { 3944 {
3960 FrameView* view = webframe->frame()->view(); 3945 FrameView* view = webframe->frame()->view();
3961 if (webframe == mainFrame()) 3946 if (webframe == mainFrame())
3962 view->resize(mainFrameSize()); 3947 view->resize(mainFrameSize());
3963 else 3948 else
3964 view->resize(webframe->frameView()->size()); 3949 view->resize(webframe->frameView()->size());
3965 } 3950 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 if (m_pageColorOverlay) 4455 if (m_pageColorOverlay)
4471 m_pageColorOverlay->update(); 4456 m_pageColorOverlay->update();
4472 if (m_inspectorOverlay) { 4457 if (m_inspectorOverlay) {
4473 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); 4458 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay();
4474 if (inspectorPageOverlay) 4459 if (inspectorPageOverlay)
4475 inspectorPageOverlay->update(); 4460 inspectorPageOverlay->update();
4476 } 4461 }
4477 } 4462 }
4478 4463
4479 } // namespace blink 4464 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698