| OLD | NEW |
| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "cc/switches.h" |
| 8 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 | 14 |
| 13 void RenderViewImpl::ScheduleUpdateFrameInfo() { | 15 void RenderViewImpl::ScheduleUpdateFrameInfo() { |
| 16 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 17 cc::switches::kEnableCompositorFrameMessage)) |
| 18 return; |
| 19 |
| 14 if (update_frame_info_scheduled_) | 20 if (update_frame_info_scheduled_) |
| 15 return; | 21 return; |
| 16 update_frame_info_scheduled_ = true; | 22 update_frame_info_scheduled_ = true; |
| 17 MessageLoop::current()->PostTask( | 23 MessageLoop::current()->PostTask( |
| 18 FROM_HERE, | 24 FROM_HERE, |
| 19 base::Bind(&RenderViewImpl::SendUpdateFrameInfo, this)); | 25 base::Bind(&RenderViewImpl::SendUpdateFrameInfo, this)); |
| 20 } | 26 } |
| 21 | 27 |
| 22 void RenderViewImpl::SendUpdateFrameInfo() { | 28 void RenderViewImpl::SendUpdateFrameInfo() { |
| 29 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 30 cc::switches::kEnableCompositorFrameMessage)) |
| 31 return; |
| 32 |
| 23 update_frame_info_scheduled_ = false; | 33 update_frame_info_scheduled_ = false; |
| 24 | 34 |
| 25 if (!webview() || !webview()->mainFrame()) | 35 if (!webview() || !webview()->mainFrame()) |
| 26 return; | 36 return; |
| 27 | 37 |
| 28 Send(new ViewHostMsg_UpdateFrameInfo( | 38 Send(new ViewHostMsg_UpdateFrameInfo( |
| 29 routing_id_, | 39 routing_id_, |
| 30 GetScrollOffset(), | 40 GetScrollOffset(), |
| 31 webview()->pageScaleFactor(), | 41 webview()->pageScaleFactor(), |
| 32 webview()->minimumPageScaleFactor(), | 42 webview()->minimumPageScaleFactor(), |
| 33 webview()->maximumPageScaleFactor(), | 43 webview()->maximumPageScaleFactor(), |
| 34 gfx::Size(webview()->mainFrame()->contentsSize()))); | 44 gfx::Size(webview()->mainFrame()->contentsSize()))); |
| 35 } | 45 } |
| 36 | 46 |
| 37 } // namespace content | 47 } // namespace content |
| OLD | NEW |