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

Unified Diff: chrome/browser/devtools/device/devtools_android_bridge.h

Issue 305013013: DevTools: DevToolsAndroidBridge polling loops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Force destruction on UI Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/devtools/device/devtools_android_bridge.h
diff --git a/chrome/browser/devtools/device/devtools_android_bridge.h b/chrome/browser/devtools/device/devtools_android_bridge.h
index 3f4ce20c74d0643d53fe51f59811f295f75ded34..ddc34bbfb4750b5b131925c7832e2ecfe8256185 100644
--- a/chrome/browser/devtools/device/devtools_android_bridge.h
+++ b/chrome/browser/devtools/device/devtools_android_bridge.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/cancelable_callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/prefs/pref_change_registrar.h"
@@ -212,6 +213,11 @@ class DevToolsAndroidBridge
device_manager_->SetDeviceProviders(device_providers);
}
+ void set_task_scheduler_for_test(
+ base::Callback<void(const base::Closure&)> scheduler) {
+ task_scheduler_ = scheduler;
+ }
+
static bool HasDevToolsWindow(const std::string& agent_id);
private:
@@ -221,11 +227,18 @@ class DevToolsAndroidBridge
virtual ~DevToolsAndroidBridge();
- void RequestDeviceList();
- void ReceivedDeviceList(scoped_ptr<RemoteDevices> devices);
- void RequestDeviceCount();
+ void StartDeviceListPolling();
+ void StopDeviceListPolling();
+ void RequestDeviceList(
+ const base::Callback<void(const RemoteDevices&)>& callback);
+ void ReceivedDeviceList(const RemoteDevices& devices);
+ void StartDeviceCountPolling();
+ void StopDeviceCountPolling();
+ void RequestDeviceCount(const base::Callback<void(int)>& callback);
void ReceivedDeviceCount(int count);
+ static void ScheduleTaskDefault(const base::Closure& task);
+
void CreateDeviceProviders();
Profile* profile_;
@@ -234,9 +247,12 @@ class DevToolsAndroidBridge
typedef std::vector<DeviceListListener*> DeviceListListeners;
DeviceListListeners device_list_listeners_;
+ base::CancelableCallback<void(const RemoteDevices&)> device_list_callback_;
typedef std::vector<DeviceCountListener*> DeviceCountListeners;
DeviceCountListeners device_count_listeners_;
+ base::CancelableCallback<void(int)> device_count_callback_;
+ base::Callback<void(const base::Closure&)> task_scheduler_;
PrefChangeRegistrar pref_change_registrar_;
DISALLOW_COPY_AND_ASSIGN(DevToolsAndroidBridge);
« no previous file with comments | « chrome/browser/devtools/device/android_device_manager.h ('k') | chrome/browser/devtools/device/devtools_android_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698