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/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1022 } |
1023 | 1023 |
1024 void RenderWidgetHostViewMac::AckPendingSwapBuffers() { | 1024 void RenderWidgetHostViewMac::AckPendingSwapBuffers() { |
1025 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AckPendingSwapBuffers"); | 1025 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AckPendingSwapBuffers"); |
1026 while (!pending_swap_buffers_acks_.empty()) { | 1026 while (!pending_swap_buffers_acks_.empty()) { |
1027 if (pending_swap_buffers_acks_.front().first != 0) { | 1027 if (pending_swap_buffers_acks_.front().first != 0) { |
1028 RenderWidgetHostImpl::AcknowledgeBufferPresent( | 1028 RenderWidgetHostImpl::AcknowledgeBufferPresent( |
1029 pending_swap_buffers_acks_.front().first, | 1029 pending_swap_buffers_acks_.front().first, |
1030 pending_swap_buffers_acks_.front().second, | 1030 pending_swap_buffers_acks_.front().second, |
1031 0); | 1031 0); |
1032 if (render_widget_host_) { | 1032 if (render_widget_host_) |
1033 render_widget_host_->AcknowledgeSwapBuffersToRenderer(); | 1033 render_widget_host_->AcknowledgeSwapBuffersToRenderer(); |
1034 | |
1035 // Send VSync parameters to compositor thread. | |
1036 if (compositing_iosurface_.get()) { | |
1037 base::TimeTicks timebase; | |
1038 uint32 numerator = 0, denominator = 0; | |
1039 compositing_iosurface_->GetVSyncParameters(&timebase, | |
1040 &numerator, | |
1041 &denominator); | |
1042 if (numerator > 0 && denominator > 0) { | |
1043 int64 interval_micros = | |
1044 1000000 * static_cast<int64>(numerator) / denominator; | |
1045 render_widget_host_->UpdateVSyncParameters( | |
1046 timebase, base::TimeDelta::FromMicroseconds(interval_micros)); | |
1047 } | |
1048 } | |
1049 } | |
1050 } | 1034 } |
1051 pending_swap_buffers_acks_.erase(pending_swap_buffers_acks_.begin()); | 1035 pending_swap_buffers_acks_.erase(pending_swap_buffers_acks_.begin()); |
1052 } | 1036 } |
1053 } | 1037 } |
1054 | 1038 |
1055 bool RenderWidgetHostViewMac::GetLineBreakIndex( | 1039 bool RenderWidgetHostViewMac::GetLineBreakIndex( |
1056 const std::vector<gfx::Rect>& bounds, | 1040 const std::vector<gfx::Rect>& bounds, |
1057 const ui::Range& range, | 1041 const ui::Range& range, |
1058 size_t* line_break_point) { | 1042 size_t* line_break_point) { |
1059 DCHECK(line_break_point); | 1043 DCHECK(line_break_point); |
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 if (!string) return NO; | 3256 if (!string) return NO; |
3273 | 3257 |
3274 // If the user is currently using an IME, confirm the IME input, | 3258 // If the user is currently using an IME, confirm the IME input, |
3275 // and then insert the text from the service, the same as TextEdit and Safari. | 3259 // and then insert the text from the service, the same as TextEdit and Safari. |
3276 [self confirmComposition]; | 3260 [self confirmComposition]; |
3277 [self insertText:string]; | 3261 [self insertText:string]; |
3278 return YES; | 3262 return YES; |
3279 } | 3263 } |
3280 | 3264 |
3281 @end | 3265 @end |
OLD | NEW |