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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 503813003: [Android] Speculative fix for crash during overscroll effect creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final check Created 6 years, 3 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 | « content/browser/renderer_host/render_widget_host_view_android.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 content_view_core_->DidStopFlinging(); 1594 content_view_core_->DidStopFlinging();
1595 } 1595 }
1596 1596
1597 void RenderWidgetHostViewAndroid::SetContentViewCore( 1597 void RenderWidgetHostViewAndroid::SetContentViewCore(
1598 ContentViewCoreImpl* content_view_core) { 1598 ContentViewCoreImpl* content_view_core) {
1599 RemoveLayers(); 1599 RemoveLayers();
1600 StopObservingRootWindow(); 1600 StopObservingRootWindow();
1601 1601
1602 bool resize = false; 1602 bool resize = false;
1603 if (content_view_core != content_view_core_) { 1603 if (content_view_core != content_view_core_) {
1604 overscroll_effect_.reset();
1604 selection_controller_.reset(); 1605 selection_controller_.reset();
1605 ReleaseLocksOnSurface(); 1606 ReleaseLocksOnSurface();
1606 resize = true; 1607 resize = true;
1607 } 1608 }
1608 1609
1609 content_view_core_ = content_view_core; 1610 content_view_core_ = content_view_core;
1610 1611
1611 BrowserAccessibilityManager* manager = NULL; 1612 BrowserAccessibilityManager* manager = NULL;
1612 if (host_) 1613 if (host_)
1613 manager = host_->GetRootBrowserAccessibilityManager(); 1614 manager = host_->GetRootBrowserAccessibilityManager();
(...skipping 10 matching lines...) Expand all
1624 return; 1625 return;
1625 1626
1626 StartObservingRootWindow(); 1627 StartObservingRootWindow();
1627 1628
1628 if (resize) 1629 if (resize)
1629 WasResized(); 1630 WasResized();
1630 1631
1631 if (!selection_controller_) 1632 if (!selection_controller_)
1632 selection_controller_.reset(new TouchSelectionController(this)); 1633 selection_controller_.reset(new TouchSelectionController(this));
1633 1634
1634 if (!content_view_core_) 1635 if (overscroll_effect_enabled_ && !overscroll_effect_ &&
1635 overscroll_effect_.reset(); 1636 content_view_core_->GetWindowAndroid()->GetCompositor())
1636 else if (overscroll_effect_enabled_ && !overscroll_effect_)
1637 overscroll_effect_ = CreateOverscrollEffect(content_view_core_); 1637 overscroll_effect_ = CreateOverscrollEffect(content_view_core_);
1638 } 1638 }
1639 1639
1640 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1640 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1641 while (!ack_callbacks_.empty()) { 1641 while (!ack_callbacks_.empty()) {
1642 ack_callbacks_.front().Run(); 1642 ack_callbacks_.front().Run();
1643 ack_callbacks_.pop(); 1643 ack_callbacks_.pop();
1644 } 1644 }
1645 } 1645 }
1646 1646
1647 void RenderWidgetHostViewAndroid::OnGestureEvent( 1647 void RenderWidgetHostViewAndroid::OnGestureEvent(
1648 const ui::GestureEventData& gesture) { 1648 const ui::GestureEventData& gesture) {
1649 if (gesture_text_selector_.OnGestureEvent(gesture)) 1649 if (gesture_text_selector_.OnGestureEvent(gesture))
1650 return; 1650 return;
1651 1651
1652 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); 1652 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture));
1653 } 1653 }
1654 1654
1655 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { 1655 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() {
1656 RunAckCallbacks(); 1656 RunAckCallbacks();
1657 } 1657 }
1658 1658
1659
1660 void RenderWidgetHostViewAndroid::OnAttachCompositor() {
1661 DCHECK(content_view_core_);
1662 if (overscroll_effect_enabled_ && !overscroll_effect_)
1663 overscroll_effect_ = CreateOverscrollEffect(content_view_core_);
1664 }
1665
1659 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1666 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1660 DCHECK(content_view_core_); 1667 DCHECK(content_view_core_);
1661 DCHECK(!using_synchronous_compositor_); 1668 DCHECK(!using_synchronous_compositor_);
1662 RunAckCallbacks(); 1669 RunAckCallbacks();
1670 overscroll_effect_.reset();
1663 } 1671 }
1664 1672
1665 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, 1673 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time,
1666 base::TimeDelta vsync_period) { 1674 base::TimeDelta vsync_period) {
1667 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); 1675 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync");
1668 if (!host_) 1676 if (!host_)
1669 return; 1677 return;
1670 1678
1671 const uint32 current_vsync_requests = outstanding_vsync_requests_; 1679 const uint32 current_vsync_requests = outstanding_vsync_requests_;
1672 outstanding_vsync_requests_ = 0; 1680 outstanding_vsync_requests_ = 0;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 results->orientationAngle = display.RotationAsDegree(); 1837 results->orientationAngle = display.RotationAsDegree();
1830 results->orientationType = 1838 results->orientationType =
1831 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1839 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1832 gfx::DeviceDisplayInfo info; 1840 gfx::DeviceDisplayInfo info;
1833 results->depth = info.GetBitsPerPixel(); 1841 results->depth = info.GetBitsPerPixel();
1834 results->depthPerComponent = info.GetBitsPerComponent(); 1842 results->depthPerComponent = info.GetBitsPerComponent();
1835 results->isMonochrome = (results->depthPerComponent == 0); 1843 results->isMonochrome = (results->depthPerComponent == 0);
1836 } 1844 }
1837 1845
1838 } // namespace content 1846 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698