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

Side by Side Diff: device/gamepad/gamepad_provider.cc

Issue 2466073002: Movw GamepadService out of content/browser/ and into device/ (Closed)
Patch Set: Fixed everything but one unittest Created 4 years, 1 month 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/gamepad/gamepad_provider.h ('k') | device/gamepad/gamepad_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "device/gamepad/gamepad_provider.h" 5 #include "device/gamepad/gamepad_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 21 matching lines...) Expand all
32 const base::Closure& c, 32 const base::Closure& c,
33 const scoped_refptr<base::SingleThreadTaskRunner>& m) 33 const scoped_refptr<base::SingleThreadTaskRunner>& m)
34 : closure(c), task_runner(m) {} 34 : closure(c), task_runner(m) {}
35 35
36 GamepadProvider::ClosureAndThread::ClosureAndThread( 36 GamepadProvider::ClosureAndThread::ClosureAndThread(
37 const ClosureAndThread& other) = default; 37 const ClosureAndThread& other) = default;
38 38
39 GamepadProvider::ClosureAndThread::~ClosureAndThread() {} 39 GamepadProvider::ClosureAndThread::~ClosureAndThread() {}
40 40
41 GamepadProvider::GamepadProvider( 41 GamepadProvider::GamepadProvider(
42 std::unique_ptr<GamepadSharedBuffer> buffer,
43 GamepadConnectionChangeClient* connection_change_client) 42 GamepadConnectionChangeClient* connection_change_client)
44 : is_paused_(true), 43 : is_paused_(true),
45 have_scheduled_do_poll_(false), 44 have_scheduled_do_poll_(false),
46 devices_changed_(true), 45 devices_changed_(true),
47 ever_had_user_gesture_(false), 46 ever_had_user_gesture_(false),
48 sanitize_(true), 47 sanitize_(true),
49 gamepad_shared_buffer_(std::move(buffer)), 48 gamepad_shared_buffer_(new GamepadSharedBuffer()),
50 connection_change_client_(connection_change_client) { 49 connection_change_client_(connection_change_client) {
51 Initialize(std::unique_ptr<GamepadDataFetcher>()); 50 Initialize(std::unique_ptr<GamepadDataFetcher>());
52 } 51 }
53 52
54 GamepadProvider::GamepadProvider( 53 GamepadProvider::GamepadProvider(
55 std::unique_ptr<GamepadSharedBuffer> buffer,
56 GamepadConnectionChangeClient* connection_change_client, 54 GamepadConnectionChangeClient* connection_change_client,
57 std::unique_ptr<GamepadDataFetcher> fetcher) 55 std::unique_ptr<GamepadDataFetcher> fetcher)
58 : is_paused_(true), 56 : is_paused_(true),
59 have_scheduled_do_poll_(false), 57 have_scheduled_do_poll_(false),
60 devices_changed_(true), 58 devices_changed_(true),
61 ever_had_user_gesture_(false), 59 ever_had_user_gesture_(false),
62 sanitize_(true), 60 sanitize_(true),
63 gamepad_shared_buffer_(std::move(buffer)), 61 gamepad_shared_buffer_(new GamepadSharedBuffer()),
64 connection_change_client_(connection_change_client) { 62 connection_change_client_(connection_change_client) {
65 Initialize(std::move(fetcher)); 63 Initialize(std::move(fetcher));
66 } 64 }
67 65
68 GamepadProvider::~GamepadProvider() { 66 GamepadProvider::~GamepadProvider() {
69 GamepadDataFetcherManager::GetInstance()->ClearProvider(); 67 GamepadDataFetcherManager::GetInstance()->ClearProvider();
70 68
71 base::SystemMonitor* monitor = base::SystemMonitor::Get(); 69 base::SystemMonitor* monitor = base::SystemMonitor::Get();
72 if (monitor) 70 if (monitor)
73 monitor->RemoveDevicesChangedObserver(this); 71 monitor->RemoveDevicesChangedObserver(this);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 ever_had_user_gesture_ = true; 309 ever_had_user_gesture_ = true;
312 for (size_t i = 0; i < user_gesture_observers_.size(); i++) { 310 for (size_t i = 0; i < user_gesture_observers_.size(); i++) {
313 user_gesture_observers_[i].task_runner->PostTask( 311 user_gesture_observers_[i].task_runner->PostTask(
314 FROM_HERE, user_gesture_observers_[i].closure); 312 FROM_HERE, user_gesture_observers_[i].closure);
315 } 313 }
316 user_gesture_observers_.clear(); 314 user_gesture_observers_.clear();
317 } 315 }
318 } 316 }
319 317
320 } // namespace device 318 } // namespace device
OLDNEW
« no previous file with comments | « device/gamepad/gamepad_provider.h ('k') | device/gamepad/gamepad_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698