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

Side by Side Diff: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc

Issue 2570553004: Clean up some VrShell threading issues and remove unnecessary WeakPtr types. (Closed)
Patch Set: rebase Created 4 years 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 | « device/vr/android/gvr/gvr_gamepad_data_fetcher.h ('k') | 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 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 "device/vr/android/gvr/gvr_gamepad_data_fetcher.h" 5 #include "device/vr/android/gvr/gvr_gamepad_data_fetcher.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 8
9 #include "device/vr/android/gvr/gvr_delegate.h" 9 #include "device/vr/android/gvr/gvr_delegate.h"
10 #include "third_party/WebKit/public/platform/WebGamepads.h" 10 #include "third_party/WebKit/public/platform/WebGamepads.h"
(...skipping 10 matching lines...) Expand all
21 21
22 const size_t str_to_copy = std::min(src.size(), dest_length - 1); 22 const size_t str_to_copy = std::min(src.size(), dest_length - 1);
23 memcpy(dest, src.data(), str_to_copy * sizeof(base::string16::value_type)); 23 memcpy(dest, src.data(), str_to_copy * sizeof(base::string16::value_type));
24 dest[str_to_copy] = 0; 24 dest[str_to_copy] = 0;
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
29 using namespace blink; 29 using namespace blink;
30 30
31 GvrGamepadDataFetcher::Factory::Factory( 31 GvrGamepadDataFetcher::Factory::Factory(GvrDelegate* delegate,
32 const base::WeakPtr<GvrDelegate>& delegate, 32 unsigned int display_id)
33 unsigned int display_id)
34 : delegate_(delegate), display_id_(display_id) {} 33 : delegate_(delegate), display_id_(display_id) {}
35 34
36 GvrGamepadDataFetcher::Factory::~Factory() {} 35 GvrGamepadDataFetcher::Factory::~Factory() {}
37 36
38 std::unique_ptr<GamepadDataFetcher> 37 std::unique_ptr<GamepadDataFetcher>
39 GvrGamepadDataFetcher::Factory::CreateDataFetcher() { 38 GvrGamepadDataFetcher::Factory::CreateDataFetcher() {
40 if (!delegate_) 39 if (!delegate_)
41 return nullptr; 40 return nullptr;
42 return base::MakeUnique<GvrGamepadDataFetcher>(delegate_.get(), display_id_); 41 return base::MakeUnique<GvrGamepadDataFetcher>(delegate_, display_id_);
43 } 42 }
44 43
45 GamepadSource GvrGamepadDataFetcher::Factory::source() { 44 GamepadSource GvrGamepadDataFetcher::Factory::source() {
46 return GAMEPAD_SOURCE_GVR; 45 return GAMEPAD_SOURCE_GVR;
47 } 46 }
48 47
49 GvrGamepadDataFetcher::GvrGamepadDataFetcher(GvrDelegate* delegate, 48 GvrGamepadDataFetcher::GvrGamepadDataFetcher(GvrDelegate* delegate,
50 unsigned int display_id) 49 unsigned int display_id)
51 : display_id_(display_id) { 50 : display_id_(display_id) {
52 gvr::GvrApi* gvr_api = delegate->gvr_api(); 51 gvr::GvrApi* gvr_api = delegate->gvr_api();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return; 143 return;
145 144
146 if (paused) { 145 if (paused) {
147 controller_api_->Pause(); 146 controller_api_->Pause();
148 } else { 147 } else {
149 controller_api_->Resume(); 148 controller_api_->Resume();
150 } 149 }
151 } 150 }
152 151
153 } // namespace device 152 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/android/gvr/gvr_gamepad_data_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698