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

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

Issue 138893003: [Android] Disable the touch ack timeout on mobile sites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Account for floating point multiplication Created 6 years, 11 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 | « no previous file | 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_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // returning a null or incorrectly sized backing-store from GetBackingStore. 94 // returning a null or incorrectly sized backing-store from GetBackingStore.
95 // This timeout impacts the "choppiness" of our window resize perf. 95 // This timeout impacts the "choppiness" of our window resize perf.
96 const int kPaintMsgTimeoutMS = 50; 96 const int kPaintMsgTimeoutMS = 50;
97 97
98 typedef std::pair<int32, int32> RenderWidgetHostID; 98 typedef std::pair<int32, int32> RenderWidgetHostID;
99 typedef base::hash_map<RenderWidgetHostID, RenderWidgetHostImpl*> 99 typedef base::hash_map<RenderWidgetHostID, RenderWidgetHostImpl*>
100 RoutingIDWidgetMap; 100 RoutingIDWidgetMap;
101 base::LazyInstance<RoutingIDWidgetMap> g_routing_id_widget_map = 101 base::LazyInstance<RoutingIDWidgetMap> g_routing_id_widget_map =
102 LAZY_INSTANCE_INITIALIZER; 102 LAZY_INSTANCE_INITIALIZER;
103 103
104 int GetInputRouterViewFlagsFromCompositorFrameMetadata(
105 const cc::CompositorFrameMetadata metadata) {
106 int view_flags = InputRouter::VIEW_FLAGS_NONE;
107
108 if (metadata.min_page_scale_factor == metadata.max_page_scale_factor)
109 view_flags |= InputRouter::FIXED_PAGE_SCALE;
110
111 const float window_width_dip =
112 std::ceil(metadata.page_scale_factor * metadata.viewport_size.width());
johnme 2014/01/15 02:15:09 Can you confirm that metadata.viewport_size.width
jdduke (slow) 2014/01/15 03:06:49 I'll double check (under basic testing the |window
jdduke (slow) 2014/01/15 21:28:50 Confirmed.
113 const float content_width_css = metadata.root_layer_size.width();
johnme 2014/01/15 02:15:09 Can you confirm that metadata.root_layer_size.widt
jdduke (slow) 2014/01/15 03:06:49 Again, I'll double check. The only difference betw
jdduke (slow) 2014/01/15 21:28:50 Confirmed.
114 if (content_width_css <= window_width_dip)
115 view_flags |= InputRouter::MOBILE_VIEWPORT;
116
117 return view_flags;
118 }
119
104 // Implements the RenderWidgetHostIterator interface. It keeps a list of 120 // Implements the RenderWidgetHostIterator interface. It keeps a list of
105 // RenderWidgetHosts, and makes sure it returns a live RenderWidgetHost at each 121 // RenderWidgetHosts, and makes sure it returns a live RenderWidgetHost at each
106 // iteration (or NULL if there isn't any left). 122 // iteration (or NULL if there isn't any left).
107 class RenderWidgetHostIteratorImpl : public RenderWidgetHostIterator { 123 class RenderWidgetHostIteratorImpl : public RenderWidgetHostIterator {
108 public: 124 public:
109 RenderWidgetHostIteratorImpl() 125 RenderWidgetHostIteratorImpl()
110 : current_index_(0) { 126 : current_index_(0) {
111 } 127 }
112 128
113 virtual ~RenderWidgetHostIteratorImpl() { 129 virtual ~RenderWidgetHostIteratorImpl() {
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1508
1493 bool RenderWidgetHostImpl::OnSwapCompositorFrame( 1509 bool RenderWidgetHostImpl::OnSwapCompositorFrame(
1494 const IPC::Message& message) { 1510 const IPC::Message& message) {
1495 ViewHostMsg_SwapCompositorFrame::Param param; 1511 ViewHostMsg_SwapCompositorFrame::Param param;
1496 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param)) 1512 if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
1497 return false; 1513 return false;
1498 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 1514 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
1499 uint32 output_surface_id = param.a; 1515 uint32 output_surface_id = param.a;
1500 param.b.AssignTo(frame.get()); 1516 param.b.AssignTo(frame.get());
1501 1517
1502 bool fixed_page_scale = 1518 input_router_->OnViewUpdated(
1503 frame->metadata.min_page_scale_factor == 1519 GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata));
1504 frame->metadata.max_page_scale_factor;
1505 int updated_view_flags = fixed_page_scale ? InputRouter::FIXED_PAGE_SCALE
1506 : InputRouter::VIEW_FLAGS_NONE;
1507 input_router_->OnViewUpdated(updated_view_flags);
1508 1520
1509 if (view_) { 1521 if (view_) {
1510 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); 1522 view_->OnSwapCompositorFrame(output_surface_id, frame.Pass());
1511 view_->DidReceiveRendererFrame(); 1523 view_->DidReceiveRendererFrame();
1512 } else { 1524 } else {
1513 cc::CompositorFrameAck ack; 1525 cc::CompositorFrameAck ack;
1514 if (frame->gl_frame_data) { 1526 if (frame->gl_frame_data) {
1515 ack.gl_frame_data = frame->gl_frame_data.Pass(); 1527 ack.gl_frame_data = frame->gl_frame_data.Pass();
1516 ack.gl_frame_data->sync_point = 0; 1528 ack.gl_frame_data->sync_point = 0;
1517 } else if (frame->delegated_frame_data) { 1529 } else if (frame->delegated_frame_data) {
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 continue; 2480 continue;
2469 } 2481 }
2470 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh); 2482 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
2471 if (rwhi_set.insert(rwhi).second) 2483 if (rwhi_set.insert(rwhi).second)
2472 rwhi->FrameSwapped(latency_info); 2484 rwhi->FrameSwapped(latency_info);
2473 } 2485 }
2474 } 2486 }
2475 } 2487 }
2476 2488
2477 } // namespace content 2489 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698