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

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

Issue 10804031: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
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_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 using base::Time; 57 using base::Time;
58 using base::TimeDelta; 58 using base::TimeDelta;
59 using base::TimeTicks; 59 using base::TimeTicks;
60 using WebKit::WebGestureEvent; 60 using WebKit::WebGestureEvent;
61 using WebKit::WebInputEvent; 61 using WebKit::WebInputEvent;
62 using WebKit::WebKeyboardEvent; 62 using WebKit::WebKeyboardEvent;
63 using WebKit::WebMouseEvent; 63 using WebKit::WebMouseEvent;
64 using WebKit::WebMouseWheelEvent; 64 using WebKit::WebMouseWheelEvent;
65 using WebKit::WebTextDirection; 65 using WebKit::WebTextDirection;
66 66
67 namespace content {
67 namespace { 68 namespace {
68 69
69 // How long to (synchronously) wait for the renderer to respond with a 70 // How long to (synchronously) wait for the renderer to respond with a
70 // PaintRect message, when our backing-store is invalid, before giving up and 71 // PaintRect message, when our backing-store is invalid, before giving up and
71 // returning a null or incorrectly sized backing-store from GetBackingStore. 72 // returning a null or incorrectly sized backing-store from GetBackingStore.
72 // This timeout impacts the "choppiness" of our window resize perf. 73 // This timeout impacts the "choppiness" of our window resize perf.
73 static const int kPaintMsgTimeoutMS = 50; 74 const int kPaintMsgTimeoutMS = 50;
74 75
75 // How long to wait before we consider a renderer hung. 76 // How long to wait before we consider a renderer hung.
76 static const int kHungRendererDelayMs = 30000; 77 const int kHungRendererDelayMs = 30000;
77 78
78 // How many milliseconds apart synthetic scroll messages should be sent. 79 // How many milliseconds apart synthetic scroll messages should be sent.
79 static const int kSyntheticScrollMessageIntervalMs = 8; 80 static const int kSyntheticScrollMessageIntervalMs = 8;
80 81
81 // Returns |true| if the two wheel events should be coalesced. 82 // Returns |true| if the two wheel events should be coalesced.
82 bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event, 83 bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event,
83 const WebMouseWheelEvent& new_event) { 84 const WebMouseWheelEvent& new_event) {
84 return last_event.modifiers == new_event.modifiers && 85 return last_event.modifiers == new_event.modifiers &&
85 last_event.scrollByPage == new_event.scrollByPage && 86 last_event.scrollByPage == new_event.scrollByPage &&
86 last_event.hasPreciseScrollingDeltas 87 last_event.hasPreciseScrollingDeltas
87 == new_event.hasPreciseScrollingDeltas && 88 == new_event.hasPreciseScrollingDeltas &&
88 last_event.phase == new_event.phase && 89 last_event.phase == new_event.phase &&
89 last_event.momentumPhase == new_event.momentumPhase; 90 last_event.momentumPhase == new_event.momentumPhase;
90 } 91 }
91 92
92 // Returns |true| if two gesture events should be coalesced. 93 // Returns |true| if two gesture events should be coalesced.
93 bool ShouldCoalesceGestureEvents(const WebKit::WebGestureEvent& last_event, 94 bool ShouldCoalesceGestureEvents(const WebKit::WebGestureEvent& last_event,
94 const WebKit::WebGestureEvent& new_event) { 95 const WebKit::WebGestureEvent& new_event) {
95 return new_event.type == WebInputEvent::GestureScrollUpdate && 96 return new_event.type == WebInputEvent::GestureScrollUpdate &&
96 last_event.type == new_event.type && 97 last_event.type == new_event.type &&
97 last_event.modifiers == new_event.modifiers; 98 last_event.modifiers == new_event.modifiers;
98 } 99 }
99 100
100 } // namespace 101 } // namespace
101 102
102 namespace content {
103
104 // static 103 // static
105 void RenderWidgetHost::RemoveAllBackingStores() { 104 void RenderWidgetHost::RemoveAllBackingStores() {
106 BackingStoreManager::RemoveAllBackingStores(); 105 BackingStoreManager::RemoveAllBackingStores();
107 } 106 }
108 107
109 // static 108 // static
110 size_t RenderWidgetHost::BackingStoreMemorySize() { 109 size_t RenderWidgetHost::BackingStoreMemorySize() {
111 return BackingStoreManager::MemorySize(); 110 return BackingStoreManager::MemorySize();
112 } 111 }
113 112
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 return false; 1112 return false;
1114 } 1113 }
1115 1114
1116 void RenderWidgetHostImpl::SetShouldAutoResize(bool enable) { 1115 void RenderWidgetHostImpl::SetShouldAutoResize(bool enable) {
1117 should_auto_resize_ = enable; 1116 should_auto_resize_ = enable;
1118 } 1117 }
1119 1118
1120 void RenderWidgetHostImpl::GetWebScreenInfo(WebKit::WebScreenInfo* result) { 1119 void RenderWidgetHostImpl::GetWebScreenInfo(WebKit::WebScreenInfo* result) {
1121 #if defined(OS_POSIX) || defined(USE_AURA) 1120 #if defined(OS_POSIX) || defined(USE_AURA)
1122 if (GetView()) { 1121 if (GetView()) {
1123 static_cast<content::RenderWidgetHostViewPort*>( 1122 static_cast<RenderWidgetHostViewPort*>(GetView())->GetScreenInfo(result);
1124 GetView())->GetScreenInfo(result);
1125 } else { 1123 } else {
1126 content::RenderWidgetHostViewPort::GetDefaultScreenInfo(result); 1124 RenderWidgetHostViewPort::GetDefaultScreenInfo(result);
1127 } 1125 }
1128 #else 1126 #else
1129 *result = WebKit::WebScreenInfoFactory::screenInfo( 1127 *result = WebKit::WebScreenInfoFactory::screenInfo(
1130 gfx::NativeViewFromId(GetNativeViewId())); 1128 gfx::NativeViewFromId(GetNativeViewId()));
1131 #endif 1129 #endif
1132 } 1130 }
1133 1131
1134 void RenderWidgetHostImpl::Destroy() { 1132 void RenderWidgetHostImpl::Destroy() {
1135 NotificationService::current()->Notify( 1133 NotificationService::current()->Notify(
1136 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 1134 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 // indicate that no callback is in progress (i.e. without this line 1906 // indicate that no callback is in progress (i.e. without this line
1909 // DelayedAutoResized will not get called again). 1907 // DelayedAutoResized will not get called again).
1910 new_auto_size_.SetSize(0, 0); 1908 new_auto_size_.SetSize(0, 0);
1911 if (!should_auto_resize_) 1909 if (!should_auto_resize_)
1912 return; 1910 return;
1913 1911
1914 OnRenderAutoResized(new_size); 1912 OnRenderAutoResized(new_size);
1915 } 1913 }
1916 1914
1917 } // namespace content 1915 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698