| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/native_viewport/native_viewport_impl.h" | 5 #include "components/native_viewport/native_viewport_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 sent_metrics_ = false; | 92 sent_metrics_ = false; |
| 93 | 93 |
| 94 if (!metrics_callback_.is_null()) { | 94 if (!metrics_callback_.is_null()) { |
| 95 metrics_callback_.Run(metrics_.Clone()); | 95 metrics_callback_.Run(metrics_.Clone()); |
| 96 metrics_callback_.reset(); | 96 metrics_callback_.reset(); |
| 97 sent_metrics_ = true; | 97 sent_metrics_ = true; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 void NativeViewportImpl::OnAcceleratedWidgetAvailable( | 101 void NativeViewportImpl::OnAcceleratedWidgetAvailable( |
| 102 gfx::AcceleratedWidget widget) { | 102 gfx::AcceleratedWidget widget, |
| 103 float device_pixel_ratio) { |
| 104 metrics_->device_pixel_ratio = device_pixel_ratio; |
| 103 context_provider_.SetAcceleratedWidget(widget); | 105 context_provider_.SetAcceleratedWidget(widget); |
| 104 // TODO: The metrics here might not match the actual window size on android | 106 // TODO: The metrics here might not match the actual window size on android |
| 105 // where we don't know the actual size until the first OnMetricsChanged call. | 107 // where we don't know the actual size until the first OnMetricsChanged call. |
| 106 create_callback_.Run(metrics_.Clone()); | 108 create_callback_.Run(metrics_.Clone()); |
| 107 sent_metrics_ = true; | 109 sent_metrics_ = true; |
| 108 create_callback_.reset(); | 110 create_callback_.reset(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 void NativeViewportImpl::OnAcceleratedWidgetDestroyed() { | 113 void NativeViewportImpl::OnAcceleratedWidgetDestroyed() { |
| 112 context_provider_.SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 114 context_provider_.SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void NativeViewportImpl::OnConnectionError() { | 157 void NativeViewportImpl::OnConnectionError() { |
| 156 binding_.set_error_handler(nullptr); | 158 binding_.set_error_handler(nullptr); |
| 157 delete this; | 159 delete this; |
| 158 } | 160 } |
| 159 | 161 |
| 160 void NativeViewportImpl::AckEvent(int32 pointer_id) { | 162 void NativeViewportImpl::AckEvent(int32 pointer_id) { |
| 161 pointers_waiting_on_ack_.erase(pointer_id); | 163 pointers_waiting_on_ack_.erase(pointer_id); |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace native_viewport | 166 } // namespace native_viewport |
| OLD | NEW |