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

Unified Diff: chrome/browser/devtools/tethering_adb_filter.h

Issue 22817003: Make TetheringAdbFilter ref-counted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/devtools/tethering_adb_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/tethering_adb_filter.h
diff --git a/chrome/browser/devtools/tethering_adb_filter.h b/chrome/browser/devtools/tethering_adb_filter.h
index af6e74c4cced02bb83e5c0a95db939e71725c37d..674489a4a42edcb6d52e7f995973814441e13e06 100644
--- a/chrome/browser/devtools/tethering_adb_filter.h
+++ b/chrome/browser/devtools/tethering_adb_filter.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "base/memory/weak_ptr.h"
+#include "base/memory/ref_counted.h"
#include "base/prefs/pref_change_registrar.h"
#include "chrome/browser/devtools/adb_web_socket.h"
#include "chrome/browser/devtools/devtools_adb_bridge.h"
@@ -20,7 +20,9 @@ namespace base {
class MessageLoop;
}
-class TetheringAdbFilter {
+class TetheringAdbFilter : public base::RefCountedThreadSafe<
+ TetheringAdbFilter,
+ content::BrowserThread::DeleteOnUIThread> {
public:
typedef DevToolsAdbBridge::RemoteDevice::PortStatus PortStatus;
typedef DevToolsAdbBridge::RemoteDevice::PortStatusMap PortStatusMap;
@@ -29,13 +31,18 @@ class TetheringAdbFilter {
base::MessageLoop* adb_message_loop,
PrefService* pref_service,
scoped_refptr<AdbWebSocket> web_socket);
- ~TetheringAdbFilter();
const PortStatusMap& GetPortStatusMap();
bool ProcessIncomingMessage(const std::string& message);
private:
+ friend struct content::BrowserThread::DeleteOnThread<
+ content::BrowserThread::UI>;
+ friend class base::DeleteHelper<TetheringAdbFilter>;
+
+ virtual ~TetheringAdbFilter();
+
typedef std::map<int, std::string> ForwardingMap;
typedef base::Callback<void(PortStatus)> CommandCallback;
@@ -67,7 +74,6 @@ class TetheringAdbFilter {
CommandCallbackMap pending_responses_;
PortStatusMap port_status_;
PortStatusMap port_status_on_ui_thread_;
- base::WeakPtrFactory<TetheringAdbFilter> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TetheringAdbFilter);
};
« no previous file with comments | « no previous file | chrome/browser/devtools/tethering_adb_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698