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

Side by Side Diff: components/exo/gamepad.h

Issue 2159283002: exo: Fix crash in out-of-order destruction of Gamepad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 | « no previous file | components/exo/gamepad.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 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 #ifndef COMPONENTS_EXO_GAMEPAD_H_ 5 #ifndef COMPONENTS_EXO_GAMEPAD_H_
6 #define COMPONENTS_EXO_GAMEPAD_H_ 6 #define COMPONENTS_EXO_GAMEPAD_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 base::Callback<std::unique_ptr<device::GamepadDataFetcher>()>; 23 base::Callback<std::unique_ptr<device::GamepadDataFetcher>()>;
24 24
25 // This class represents one or more gamepads, it uses a background thread 25 // This class represents one or more gamepads, it uses a background thread
26 // for polling gamepad devices and notifies the GamepadDelegate of any 26 // for polling gamepad devices and notifies the GamepadDelegate of any
27 // changes. 27 // changes.
28 class Gamepad : public aura::client::FocusChangeObserver { 28 class Gamepad : public aura::client::FocusChangeObserver {
29 public: 29 public:
30 // This class will post tasks to invoke the delegate on the thread runner 30 // This class will post tasks to invoke the delegate on the thread runner
31 // which is associated with the thread that is creating this instance. 31 // which is associated with the thread that is creating this instance.
32 Gamepad(GamepadDelegate* delegate, 32 Gamepad(GamepadDelegate* delegate,
33 base::SingleThreadTaskRunner* polling_task_runner); 33 scoped_refptr<base::SingleThreadTaskRunner> polling_task_runner);
reveman 2016/07/19 17:16:53 This just adds ref-count churn. Passing a raw poin
34 // Allows test cases to specify a CreateGamepadDataFetcherCallback that 34 // Allows test cases to specify a CreateGamepadDataFetcherCallback that
35 // overrides the default GamepadPlatformDataFetcher. 35 // overrides the default GamepadPlatformDataFetcher.
36 Gamepad(GamepadDelegate* delegate, 36 Gamepad(GamepadDelegate* delegate,
37 base::SingleThreadTaskRunner* polling_task_runner, 37 scoped_refptr<base::SingleThreadTaskRunner> polling_task_runner,
reveman 2016/07/19 17:16:53 ditto
38 CreateGamepadDataFetcherCallback create_fetcher_callback); 38 CreateGamepadDataFetcherCallback create_fetcher_callback);
39 ~Gamepad() override; 39 ~Gamepad() override;
40 40
41 // Overridden aura::client::FocusChangeObserver: 41 // Overridden aura::client::FocusChangeObserver:
42 void OnWindowFocused(aura::Window* gained_focus, 42 void OnWindowFocused(aura::Window* gained_focus,
43 aura::Window* lost_focus) override; 43 aura::Window* lost_focus) override;
44 44
45 private: 45 private:
46 class ThreadSafeGamepadChangeFetcher; 46 class ThreadSafeGamepadChangeFetcher;
47 47
(...skipping 14 matching lines...) Expand all
62 base::ThreadChecker thread_checker_; 62 base::ThreadChecker thread_checker_;
63 63
64 base::WeakPtrFactory<Gamepad> weak_factory_; 64 base::WeakPtrFactory<Gamepad> weak_factory_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(Gamepad); 66 DISALLOW_COPY_AND_ASSIGN(Gamepad);
67 }; 67 };
68 68
69 } // namespace exo 69 } // namespace exo
70 70
71 #endif // COMPONENTS_EXO_GAMEPAD_H_ 71 #endif // COMPONENTS_EXO_GAMEPAD_H_
OLDNEW
« no previous file with comments | « no previous file | components/exo/gamepad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698