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

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

Issue 1094453004: Revert of Remove WebViewImpl::setIsAcceleratedCompositingActive (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 #if ENABLE(OILPAN) 333 #if ENABLE(OILPAN)
334 deferrer->dispose(); 334 deferrer->dispose();
335 #else 335 #else
336 delete deferrer; 336 delete deferrer;
337 #endif 337 #endif
338 pageLoadDeferrerStack().removeLast(); 338 pageLoadDeferrerStack().removeLast();
339 } 339 }
340 340
341 void WebViewImpl::setMainFrame(WebFrame* frame) 341 void WebViewImpl::setMainFrame(WebFrame* frame)
342 { 342 {
343 if (frame->isWebLocalFrame()) { 343 if (frame->isWebLocalFrame())
344 WebLocalFrameImpl* localFrame = toWebLocalFrameImpl(frame); 344 toWebLocalFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullAtom);
345 localFrame->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullA tom); 345 else
346 // Composited WebViews want repaints outside the frame visible rect.
347 localFrame->frame()->view()->setClipsRepaints(!m_layerTreeView);
348 } else {
349 toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0 , nullAtom); 346 toWebRemoteFrameImpl(frame)->initializeCoreFrame(&page()->frameHost(), 0 , nullAtom);
350 }
351 } 347 }
352 348
353 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred entialManagerClient) 349 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred entialManagerClient)
354 { 350 {
355 ASSERT(m_page); 351 ASSERT(m_page);
356 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre dentialManagerClient)); 352 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre dentialManagerClient));
357 } 353 }
358 354
359 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient) 355 void WebViewImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient)
360 { 356 {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 , m_operationsAllowed(WebDragOperationNone) 405 , m_operationsAllowed(WebDragOperationNone)
410 , m_dragOperation(WebDragOperationNone) 406 , m_dragOperation(WebDragOperationNone)
411 , m_devToolsEmulator(nullptr) 407 , m_devToolsEmulator(nullptr)
412 , m_isTransparent(false) 408 , m_isTransparent(false)
413 , m_tabsToLinks(false) 409 , m_tabsToLinks(false)
414 , m_layerTreeView(0) 410 , m_layerTreeView(0)
415 , m_rootLayer(0) 411 , m_rootLayer(0)
416 , m_rootGraphicsLayer(0) 412 , m_rootGraphicsLayer(0)
417 , m_rootTransformLayer(0) 413 , m_rootTransformLayer(0)
418 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this))) 414 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this)))
415 , m_isAcceleratedCompositingActive(false)
416 , m_layerTreeViewCommitsDeferred(false)
417 , m_layerTreeViewClosed(false)
419 , m_matchesHeuristicsForGpuRasterization(false) 418 , m_matchesHeuristicsForGpuRasterization(false)
420 , m_recreatingGraphicsContext(false) 419 , m_recreatingGraphicsContext(false)
421 , m_flingModifier(0) 420 , m_flingModifier(0)
422 , m_flingSourceDevice(false) 421 , m_flingSourceDevice(false)
423 , m_fullscreenController(FullscreenController::create(this)) 422 , m_fullscreenController(FullscreenController::create(this))
424 , m_showFPSCounter(false) 423 , m_showFPSCounter(false)
424 , m_showPaintRects(false)
425 , m_showDebugBorders(false)
425 , m_continuousPaintingEnabled(false) 426 , m_continuousPaintingEnabled(false)
427 , m_showScrollBottleneckRects(false)
426 , m_baseBackgroundColor(Color::white) 428 , m_baseBackgroundColor(Color::white)
427 , m_backgroundColorOverride(Color::transparent) 429 , m_backgroundColorOverride(Color::transparent)
428 , m_zoomFactorOverride(0) 430 , m_zoomFactorOverride(0)
429 , m_userGestureObserved(false) 431 , m_userGestureObserved(false)
430 , m_displayMode(WebDisplayModeBrowser) 432 , m_displayMode(WebDisplayModeBrowser)
431 { 433 {
432 Page::PageClients pageClients; 434 Page::PageClients pageClients;
433 pageClients.chromeClient = &m_chromeClientImpl; 435 pageClients.chromeClient = &m_chromeClientImpl;
434 pageClients.contextMenuClient = &m_contextMenuClientImpl; 436 pageClients.contextMenuClient = &m_contextMenuClientImpl;
435 pageClients.editorClient = &m_editorClientImpl; 437 pageClients.editorClient = &m_editorClientImpl;
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 960 }
959 m_showFPSCounter = show; 961 m_showFPSCounter = show;
960 } 962 }
961 963
962 void WebViewImpl::setShowPaintRects(bool show) 964 void WebViewImpl::setShowPaintRects(bool show)
963 { 965 {
964 if (m_layerTreeView) { 966 if (m_layerTreeView) {
965 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects"); 967 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects");
966 m_layerTreeView->setShowPaintRects(show); 968 m_layerTreeView->setShowPaintRects(show);
967 } 969 }
970 m_showPaintRects = show;
968 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show); 971 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show);
969 } 972 }
970 973
971 void WebViewImpl::setShowDebugBorders(bool show) 974 void WebViewImpl::setShowDebugBorders(bool show)
972 { 975 {
973 if (m_layerTreeView) 976 if (m_layerTreeView)
974 m_layerTreeView->setShowDebugBorders(show); 977 m_layerTreeView->setShowDebugBorders(show);
978 m_showDebugBorders = show;
975 } 979 }
976 980
977 void WebViewImpl::setContinuousPaintingEnabled(bool enabled) 981 void WebViewImpl::setContinuousPaintingEnabled(bool enabled)
978 { 982 {
979 if (m_layerTreeView) { 983 if (m_layerTreeView) {
980 TRACE_EVENT0("blink", "WebViewImpl::setContinuousPaintingEnabled"); 984 TRACE_EVENT0("blink", "WebViewImpl::setContinuousPaintingEnabled");
981 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. 985 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837.
982 m_layerTreeView->setContinuousPaintingEnabled(enabled && !m_devToolsEmul ator->deviceEmulationEnabled()); 986 m_layerTreeView->setContinuousPaintingEnabled(enabled && !m_devToolsEmul ator->deviceEmulationEnabled());
983 } 987 }
984 m_continuousPaintingEnabled = enabled; 988 m_continuousPaintingEnabled = enabled;
985 if (m_client) 989 if (m_client)
986 m_client->scheduleAnimation(); 990 m_client->scheduleAnimation();
987 } 991 }
988 992
989 void WebViewImpl::updateShowFPSCounterAndContinuousPainting() 993 void WebViewImpl::updateShowFPSCounterAndContinuousPainting()
990 { 994 {
991 if (m_layerTreeView) { 995 if (m_layerTreeView) {
992 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837. 996 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837.
993 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable d && !m_devToolsEmulator->deviceEmulationEnabled()); 997 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable d && !m_devToolsEmulator->deviceEmulationEnabled());
994 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled()); 998 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled());
995 } 999 }
996 } 1000 }
997 1001
998 void WebViewImpl::setShowScrollBottleneckRects(bool show) 1002 void WebViewImpl::setShowScrollBottleneckRects(bool show)
999 { 1003 {
1000 if (m_layerTreeView) 1004 if (m_layerTreeView)
1001 m_layerTreeView->setShowScrollBottleneckRects(show); 1005 m_layerTreeView->setShowScrollBottleneckRects(show);
1006 m_showScrollBottleneckRects = show;
1002 } 1007 }
1003 1008
1004 void WebViewImpl::acceptLanguagesChanged() 1009 void WebViewImpl::acceptLanguagesChanged()
1005 { 1010 {
1006 if (!page()) 1011 if (!page())
1007 return; 1012 return;
1008 1013
1009 page()->acceptLanguagesChanged(); 1014 page()->acceptLanguagesChanged();
1010 } 1015 }
1011 1016
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 break; 2725 break;
2721 2726
2722 default: 2727 default:
2723 notImplemented(); 2728 notImplemented();
2724 break; 2729 break;
2725 } 2730 }
2726 } 2731 }
2727 2732
2728 bool WebViewImpl::isAcceleratedCompositingActive() const 2733 bool WebViewImpl::isAcceleratedCompositingActive() const
2729 { 2734 {
2730 return m_rootLayer; 2735 return m_isAcceleratedCompositingActive;
2731 } 2736 }
2732 2737
2733 void WebViewImpl::willCloseLayerTreeView() 2738 void WebViewImpl::willCloseLayerTreeView()
2734 { 2739 {
2740 setIsAcceleratedCompositingActive(false);
2735 m_layerTreeView = 0; 2741 m_layerTreeView = 0;
2742 m_layerTreeViewClosed = true;
2736 } 2743 }
2737 2744
2738 void WebViewImpl::didAcquirePointerLock() 2745 void WebViewImpl::didAcquirePointerLock()
2739 { 2746 {
2740 if (page()) 2747 if (page())
2741 page()->pointerLockController().didAcquirePointerLock(); 2748 page()->pointerLockController().didAcquirePointerLock();
2742 } 2749 }
2743 2750
2744 void WebViewImpl::didNotAcquirePointerLock() 2751 void WebViewImpl::didNotAcquirePointerLock()
2745 { 2752 {
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3692 { 3699 {
3693 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent 3700 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent
3694 // as part of layout. Layout is also responsible for sending invalidations 3701 // as part of layout. Layout is also responsible for sending invalidations
3695 // to the embedder. This method and all callers may be wrong. -- eseidel. 3702 // to the embedder. This method and all callers may be wrong. -- eseidel.
3696 if (mainFrameImpl()->frameView()) { 3703 if (mainFrameImpl()->frameView()) {
3697 // Enqueues the resize event. 3704 // Enqueues the resize event.
3698 mainFrameImpl()->frame()->document()->enqueueResizeEvent(); 3705 mainFrameImpl()->frame()->document()->enqueueResizeEvent();
3699 } 3706 }
3700 3707
3701 if (m_client) { 3708 if (m_client) {
3702 if (m_layerTreeView) { 3709 if (isAcceleratedCompositingActive()) {
3703 updateLayerTreeViewport(); 3710 updateLayerTreeViewport();
3704 } else { 3711 } else {
3705 WebRect damagedRect(0, 0, m_size.width, m_size.height); 3712 WebRect damagedRect(0, 0, m_size.width, m_size.height);
3706 m_client->didInvalidateRect(damagedRect); 3713 m_client->didInvalidateRect(damagedRect);
3707 } 3714 }
3708 } 3715 }
3709 if (m_pageOverlays) 3716 if (m_pageOverlays)
3710 m_pageOverlays->update(); 3717 m_pageOverlays->update();
3711 m_devToolsEmulator->viewportChanged(); 3718 m_devToolsEmulator->viewportChanged();
3712 } 3719 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3840 // Set any existing frames to be transparent. 3847 // Set any existing frames to be transparent.
3841 Frame* frame = m_page->mainFrame(); 3848 Frame* frame = m_page->mainFrame();
3842 while (frame) { 3849 while (frame) {
3843 if (frame->isLocalFrame()) 3850 if (frame->isLocalFrame())
3844 toLocalFrame(frame)->view()->setTransparent(isTransparent); 3851 toLocalFrame(frame)->view()->setTransparent(isTransparent);
3845 frame = frame->tree().traverseNext(); 3852 frame = frame->tree().traverseNext();
3846 } 3853 }
3847 3854
3848 // Future frames check this to know whether to be transparent. 3855 // Future frames check this to know whether to be transparent.
3849 m_isTransparent = isTransparent; 3856 m_isTransparent = isTransparent;
3850
3851 if (m_layerTreeView)
3852 m_layerTreeView->setHasTransparentBackground(this->isTransparent());
3853 } 3857 }
3854 3858
3855 bool WebViewImpl::isTransparent() const 3859 bool WebViewImpl::isTransparent() const
3856 { 3860 {
3857 return m_isTransparent; 3861 return m_isTransparent;
3858 } 3862 }
3859 3863
3860 void WebViewImpl::setBaseBackgroundColor(WebColor color) 3864 void WebViewImpl::setBaseBackgroundColor(WebColor color)
3861 { 3865 {
3862 layout(); 3866 layout();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 return; 3947 return;
3944 3948
3945 // If we have no more stylesheets to load and we're past the body tag, 3949 // If we have no more stylesheets to load and we're past the body tag,
3946 // we should have something to paint and should start as soon as possible. 3950 // we should have something to paint and should start as soon as possible.
3947 if (m_page->deprecatedLocalMainFrame()->document()->body()) 3951 if (m_page->deprecatedLocalMainFrame()->document()->body())
3948 resumeTreeViewCommits(); 3952 resumeTreeViewCommits();
3949 } 3953 }
3950 3954
3951 void WebViewImpl::resumeTreeViewCommits() 3955 void WebViewImpl::resumeTreeViewCommits()
3952 { 3956 {
3953 if (m_layerTreeView) 3957 if (m_layerTreeViewCommitsDeferred) {
3954 m_layerTreeView->setDeferCommits(false); 3958 if (m_layerTreeView)
3959 m_layerTreeView->setDeferCommits(false);
3960 m_layerTreeViewCommitsDeferred = false;
3961 }
3955 } 3962 }
3956 3963
3957 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) 3964 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe)
3958 { 3965 {
3959 FrameView* view = webframe->frame()->view(); 3966 FrameView* view = webframe->frame()->view();
3960 if (webframe == mainFrame()) 3967 if (webframe == mainFrame())
3961 view->resize(mainFrameSize()); 3968 view->resize(mainFrameSize());
3962 else 3969 else
3963 view->resize(webframe->frameView()->layoutSize()); 3970 view->resize(webframe->frameView()->layoutSize());
3964 } 3971 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
4140 } 4147 }
4141 4148
4142 void WebViewImpl::suppressInvalidations(bool enable) 4149 void WebViewImpl::suppressInvalidations(bool enable)
4143 { 4150 {
4144 if (m_client) 4151 if (m_client)
4145 m_client->suppressCompositorScheduling(enable); 4152 m_client->suppressCompositorScheduling(enable);
4146 } 4153 }
4147 4154
4148 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 4155 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
4149 { 4156 {
4150 if (!m_layerTreeView)
4151 return;
4152
4153 suppressInvalidations(true); 4157 suppressInvalidations(true);
4154 4158
4155 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 4159 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
4156 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); 4160 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory());
4157 if (layer) { 4161 if (layer) {
4158 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); 4162 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer();
4159 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); 4163 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer();
4160 m_rootTransformLayer = pinchViewport.rootGraphicsLayer(); 4164 m_rootTransformLayer = pinchViewport.rootGraphicsLayer();
4161 updateRootLayerTransform();
4162 } else { 4165 } else {
4163 m_rootGraphicsLayer = nullptr; 4166 m_rootGraphicsLayer = nullptr;
4164 m_rootLayer = nullptr; 4167 m_rootLayer = nullptr;
4165 m_rootTransformLayer = nullptr; 4168 m_rootTransformLayer = nullptr;
4166 // This means that we're transitioning to a new page. Suppress
4167 // commits until Blink generates invalidations so we don't
4168 // attempt to paint too early in the next page load.
4169 m_layerTreeView->setDeferCommits(true);
4170 } 4169 }
4171 4170
4171 setIsAcceleratedCompositingActive(layer != 0);
4172
4173 updateRootLayerTransform();
4174
4172 if (m_layerTreeView) { 4175 if (m_layerTreeView) {
4173 if (m_rootLayer) { 4176 if (m_rootLayer) {
4174 m_layerTreeView->setRootLayer(*m_rootLayer); 4177 m_layerTreeView->setRootLayer(*m_rootLayer);
4175 // We register viewport layers here since there may not be a layer 4178 // We register viewport layers here since there may not be a layer
4176 // tree view prior to this point. 4179 // tree view prior to this point.
4177 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_lay erTreeView); 4180 page()->frameHost().pinchViewport().registerLayersWithTreeView(m_lay erTreeView);
4178 if (m_pageOverlays)
4179 m_pageOverlays->update();
4180 } else { 4181 } else {
4181 m_layerTreeView->clearRootLayer(); 4182 m_layerTreeView->clearRootLayer();
4182 page()->frameHost().pinchViewport().clearLayersForTreeView(m_layerTr eeView); 4183 page()->frameHost().pinchViewport().clearLayersForTreeView(m_layerTr eeView);
4183 } 4184 }
4184 } 4185 }
4185 4186
4186 suppressInvalidations(false); 4187 suppressInvalidations(false);
4187 } 4188 }
4188 4189
4189 void WebViewImpl::scheduleCompositingLayerSync() 4190 void WebViewImpl::scheduleCompositingLayerSync()
4190 { 4191 {
4191 m_layerTreeView->setNeedsAnimate(); 4192 m_layerTreeView->setNeedsAnimate();
4192 } 4193 }
4193 4194
4194 void WebViewImpl::invalidateRect(const IntRect& rect) 4195 void WebViewImpl::invalidateRect(const IntRect& rect)
4195 { 4196 {
4196 if (m_layerTreeView) 4197 if (m_isAcceleratedCompositingActive) {
4198 ASSERT(m_layerTreeView);
4197 updateLayerTreeViewport(); 4199 updateLayerTreeViewport();
4198 else if (m_client) 4200 } else if (m_client)
4199 m_client->didInvalidateRect(rect); 4201 m_client->didInvalidateRect(rect);
4200 } 4202 }
4201 4203
4202 GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 4204 GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
4203 { 4205 {
4204 return m_graphicsLayerFactory.get(); 4206 return m_graphicsLayerFactory.get();
4205 } 4207 }
4206 4208
4207 DeprecatedPaintLayerCompositor* WebViewImpl::compositor() const 4209 DeprecatedPaintLayerCompositor* WebViewImpl::compositor() const
4208 { 4210 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
4255 m_layerTreeView = m_client->layerTreeView(); 4257 m_layerTreeView = m_client->layerTreeView();
4256 } 4258 }
4257 4259
4258 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView != 0); 4260 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView != 0);
4259 4261
4260 // FIXME: only unittests, click to play, Android priting, and printing (for headers and footers) 4262 // FIXME: only unittests, click to play, Android priting, and printing (for headers and footers)
4261 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView. 4263 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView.
4262 ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew()); 4264 ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew());
4263 } 4265 }
4264 4266
4267 void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
4268 {
4269 // In the middle of shutting down; don't try to spin back up a compositor.
4270 // FIXME: compositing startup/shutdown should be refactored so that it
4271 // turns on explicitly rather than lazily, which causes this awkwardness.
4272 if (m_layerTreeViewClosed)
4273 return;
4274
4275 ASSERT(!active || m_layerTreeView);
4276 Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompositingAc tive", active * 2 + m_isAcceleratedCompositingActive, 4);
4277
4278 if (m_isAcceleratedCompositingActive == active)
4279 return;
4280
4281 if (!m_client)
4282 return;
4283
4284 if (!active) {
4285 m_isAcceleratedCompositingActive = false;
4286 if (!m_layerTreeViewCommitsDeferred) {
4287 ASSERT(m_layerTreeView);
4288 // This means that we're transitioning to a new page. Suppress commi ts until WebKit generates invalidations so
4289 // we don't attempt to paint too early in the next page load.
4290 m_layerTreeView->setDeferCommits(true);
4291 m_layerTreeViewCommitsDeferred = true;
4292 }
4293 } else {
4294 TRACE_EVENT0("blink", "WebViewImpl::setIsAcceleratedCompositingActive(tr ue)");
4295 m_layerTreeView->setRootLayer(*m_rootLayer);
4296
4297 bool visible = page()->visibilityState() == PageVisibilityStateVisible;
4298 m_layerTreeView->setVisible(visible);
4299 updateLayerTreeDeviceScaleFactor();
4300 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumP ageScaleFactor(), maximumPageScaleFactor());
4301 updateLayerTreeBackgroundColor();
4302 m_layerTreeView->setHasTransparentBackground(isTransparent());
4303 updateLayerTreeViewport();
4304 m_isAcceleratedCompositingActive = true;
4305 if (m_pageOverlays)
4306 m_pageOverlays->update();
4307 // FIXME: allow emulation, fps counter and continuous painting at the sa me time: crbug.com/299837.
4308 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled());
4309 m_layerTreeView->setShowPaintRects(m_showPaintRects);
4310 m_layerTreeView->setShowDebugBorders(m_showDebugBorders);
4311 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnable d && !m_devToolsEmulator->deviceEmulationEnabled());
4312 m_layerTreeView->setShowScrollBottleneckRects(m_showScrollBottleneckRect s);
4313 m_layerTreeView->heuristicsForGpuRasterizationUpdated(m_matchesHeuristic sForGpuRasterization);
4314 }
4315 if (page() && page()->mainFrame()->isLocalFrame())
4316 page()->deprecatedLocalMainFrame()->view()->setClipsRepaints(!m_isAccele ratedCompositingActive);
4317 }
4318
4265 void WebViewImpl::updateMainFrameScrollPosition(const DoublePoint& scrollPositio n, bool programmaticScroll) 4319 void WebViewImpl::updateMainFrameScrollPosition(const DoublePoint& scrollPositio n, bool programmaticScroll)
4266 { 4320 {
4267 if (!page()->mainFrame()->isLocalFrame()) 4321 if (!page()->mainFrame()->isLocalFrame())
4268 return; 4322 return;
4269 4323
4270 // FIXME(305811): Refactor for OOPI. 4324 // FIXME(305811): Refactor for OOPI.
4271 FrameView* frameView = page()->deprecatedLocalMainFrame()->view(); 4325 FrameView* frameView = page()->deprecatedLocalMainFrame()->view();
4272 if (!frameView) 4326 if (!frameView)
4273 return; 4327 return;
4274 4328
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
4376 WebContentDetectionResult content = m_client->detectContentAround(touchHit); 4430 WebContentDetectionResult content = m_client->detectContentAround(touchHit);
4377 if (!content.isValid()) 4431 if (!content.isValid())
4378 return false; 4432 return false;
4379 4433
4380 m_client->scheduleContentIntent(content.intent()); 4434 m_client->scheduleContentIntent(content.intent());
4381 return true; 4435 return true;
4382 } 4436 }
4383 4437
4384 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, 4438 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
4385 bool isInitialState) { 4439 bool isInitialState) {
4440 if (!page())
4441 return;
4442
4386 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere nder); 4443 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere nder);
4387 4444 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast<int> (visibilityState)), isInitialState);
4388 if (page())
4389 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState);
4390 4445
4391 if (m_layerTreeView) { 4446 if (m_layerTreeView) {
4392 bool visible = visibilityState == WebPageVisibilityStateVisible; 4447 bool visible = visibilityState == WebPageVisibilityStateVisible;
4393 m_layerTreeView->setVisible(visible); 4448 m_layerTreeView->setVisible(visible);
4394 } 4449 }
4395 } 4450 }
4396 4451
4397 bool WebViewImpl::requestPointerLock() 4452 bool WebViewImpl::requestPointerLock()
4398 { 4453 {
4399 return m_client && m_client->requestPointerLock(); 4454 return m_client && m_client->requestPointerLock();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4457 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4512 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4458 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4513 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4459 } 4514 }
4460 4515
4461 void WebViewImpl::forceNextWebGLContextCreationToFail() 4516 void WebViewImpl::forceNextWebGLContextCreationToFail()
4462 { 4517 {
4463 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4518 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4464 } 4519 }
4465 4520
4466 } // namespace blink 4521 } // 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