OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" | 5 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" | 10 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } else { | 108 } else { |
109 pending_vsync_ = true; | 109 pending_vsync_ = true; |
110 pending_time_ = time; | 110 pending_time_ = time; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 void NonPresentingGvrDelegate::GetVSync(const GetVSyncCallback& callback) { | 114 void NonPresentingGvrDelegate::GetVSync(const GetVSyncCallback& callback) { |
115 if (!pending_vsync_) { | 115 if (!pending_vsync_) { |
116 if (!callback_.is_null()) { | 116 if (!callback_.is_null()) { |
117 mojo::ReportBadMessage( | 117 mojo::ReportBadMessage( |
118 "Requested VSync before waiting for response to " | 118 "Requested VSync before waiting for response to previous request."); |
119 "previous request."); | |
120 binding_.Close(); | 119 binding_.Close(); |
121 return; | 120 return; |
122 } | 121 } |
123 callback_ = callback; | 122 callback_ = callback; |
124 return; | 123 return; |
125 } | 124 } |
126 pending_vsync_ = false; | 125 pending_vsync_ = false; |
127 SendVSync(pending_time_, callback); | 126 SendVSync(pending_time_, callback); |
128 } | 127 } |
129 | 128 |
(...skipping 26 matching lines...) Expand all Loading... |
156 } | 155 } |
157 | 156 |
158 gfx::Size webvr_size = GvrDelegate::GetRecommendedWebVrSize(gvr_api_.get()); | 157 gfx::Size webvr_size = GvrDelegate::GetRecommendedWebVrSize(gvr_api_.get()); |
159 DVLOG(1) << __FUNCTION__ << ": resize recommended to " << webvr_size.width() | 158 DVLOG(1) << __FUNCTION__ << ": resize recommended to " << webvr_size.width() |
160 << "x" << webvr_size.height(); | 159 << "x" << webvr_size.height(); |
161 callback.Run( | 160 callback.Run( |
162 GvrDelegate::CreateVRDisplayInfo(gvr_api_.get(), webvr_size, device_id)); | 161 GvrDelegate::CreateVRDisplayInfo(gvr_api_.get(), webvr_size, device_id)); |
163 } | 162 } |
164 | 163 |
165 } // namespace vr_shell | 164 } // namespace vr_shell |
OLD | NEW |