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

Side by Side Diff: chrome/browser/devtools/device/android_device_manager.h

Issue 2913693002: Replace deprecated base::NonThreadSafe in chrome/browser/devtools in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/sequence_checker.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "base/threading/non_thread_safe.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
18 18
19 namespace net { 19 namespace net {
20 class StreamSocket; 20 class StreamSocket;
21 } 21 }
22 22
23 class AndroidDeviceManager : public base::NonThreadSafe { 23 class AndroidDeviceManager {
24 public: 24 public:
25 using CommandCallback = 25 using CommandCallback =
26 base::Callback<void(int, const std::string&)>; 26 base::Callback<void(int, const std::string&)>;
27 using SocketCallback = 27 using SocketCallback =
28 base::Callback<void(int result, std::unique_ptr<net::StreamSocket>)>; 28 base::Callback<void(int result, std::unique_ptr<net::StreamSocket>)>;
29 // |body_head| should contain the body (WebSocket frame data) part that has 29 // |body_head| should contain the body (WebSocket frame data) part that has
30 // been read during processing the header (WebSocket handshake). 30 // been read during processing the header (WebSocket handshake).
31 using HttpUpgradeCallback = 31 using HttpUpgradeCallback =
32 base::Callback<void(int result, 32 base::Callback<void(int result,
33 const std::string& extensions, 33 const std::string& extensions,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 scoped_refptr<Device> device_; 101 scoped_refptr<Device> device_;
102 WebSocketImpl* socket_impl_; 102 WebSocketImpl* socket_impl_;
103 Delegate* delegate_; 103 Delegate* delegate_;
104 base::WeakPtrFactory<AndroidWebSocket> weak_factory_; 104 base::WeakPtrFactory<AndroidWebSocket> weak_factory_;
105 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket); 105 DISALLOW_COPY_AND_ASSIGN(AndroidWebSocket);
106 }; 106 };
107 107
108 class DeviceProvider; 108 class DeviceProvider;
109 109
110 class Device : public base::RefCountedThreadSafe<Device>, 110 class Device : public base::RefCountedThreadSafe<Device> {
111 public base::NonThreadSafe {
112 public: 111 public:
113 void QueryDeviceInfo(const DeviceInfoCallback& callback); 112 void QueryDeviceInfo(const DeviceInfoCallback& callback);
114 113
115 void OpenSocket(const std::string& socket_name, 114 void OpenSocket(const std::string& socket_name,
116 const SocketCallback& callback); 115 const SocketCallback& callback);
117 116
118 void SendJsonRequest(const std::string& socket_name, 117 void SendJsonRequest(const std::string& socket_name,
119 const std::string& request, 118 const std::string& request,
120 const CommandCallback& callback); 119 const CommandCallback& callback);
121 120
(...skipping 15 matching lines...) Expand all
137 136
138 Device(scoped_refptr<base::SingleThreadTaskRunner> device_task_runner, 137 Device(scoped_refptr<base::SingleThreadTaskRunner> device_task_runner,
139 scoped_refptr<DeviceProvider> provider, 138 scoped_refptr<DeviceProvider> provider,
140 const std::string& serial); 139 const std::string& serial);
141 140
142 virtual ~Device(); 141 virtual ~Device();
143 142
144 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 143 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
145 scoped_refptr<DeviceProvider> provider_; 144 scoped_refptr<DeviceProvider> provider_;
146 std::string serial_; 145 std::string serial_;
146
147 SEQUENCE_CHECKER(sequence_checker_);
148
147 base::WeakPtrFactory<Device> weak_factory_; 149 base::WeakPtrFactory<Device> weak_factory_;
148 150
149 DISALLOW_COPY_AND_ASSIGN(Device); 151 DISALLOW_COPY_AND_ASSIGN(Device);
150 }; 152 };
151 153
152 typedef std::vector<scoped_refptr<Device> > Devices; 154 typedef std::vector<scoped_refptr<Device> > Devices;
153 typedef base::Callback<void(const Devices&)> DevicesCallback; 155 typedef base::Callback<void(const Devices&)> DevicesCallback;
154 156
155 class DeviceProvider : public base::RefCountedThreadSafe<DeviceProvider> { 157 class DeviceProvider : public base::RefCountedThreadSafe<DeviceProvider> {
156 public: 158 public:
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 238
237 void UpdateDevices(const DevicesCallback& callback, 239 void UpdateDevices(const DevicesCallback& callback,
238 std::unique_ptr<DeviceDescriptors> descriptors); 240 std::unique_ptr<DeviceDescriptors> descriptors);
239 241
240 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; 242 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap;
241 243
242 scoped_refptr<HandlerThread> handler_thread_; 244 scoped_refptr<HandlerThread> handler_thread_;
243 DeviceProviders providers_; 245 DeviceProviders providers_;
244 DeviceWeakMap devices_; 246 DeviceWeakMap devices_;
245 247
248 SEQUENCE_CHECKER(sequence_checker_);
249
246 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_; 250 base::WeakPtrFactory<AndroidDeviceManager> weak_factory_;
247 }; 251 };
248 252
249 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ 253 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/adb/mock_adb_server.cc ('k') | chrome/browser/devtools/device/android_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698