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

Unified Diff: chrome/browser/debugger/devtools_protocol_handler.cc

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « chrome/browser/debugger/devtools_protocol_handler.h ('k') | chrome/browser/dom_ui/new_tab_ui_uitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/debugger/devtools_protocol_handler.cc
===================================================================
--- chrome/browser/debugger/devtools_protocol_handler.cc (revision 30650)
+++ chrome/browser/debugger/devtools_protocol_handler.cc (working copy)
@@ -5,8 +5,7 @@
#include "chrome/browser/debugger/devtools_protocol_handler.h"
#include "base/logging.h"
-#include "base/thread.h"
-#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/debugger/inspectable_tab_proxy.h"
#include "chrome/browser/debugger/devtools_remote_message.h"
#include "chrome/browser/debugger/devtools_remote_listen_socket.h"
@@ -16,8 +15,6 @@
: port_(port),
connection_(NULL),
server_(NULL) {
- ui_loop_ = MessageLoop::current();
- io_loop_ = g_browser_process->io_thread()->message_loop();
inspectable_tab_proxy_.reset(new InspectableTabProxy);
}
@@ -28,8 +25,9 @@
}
void DevToolsProtocolHandler::Start() {
- io_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &DevToolsProtocolHandler::Init));
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableMethod(this, &DevToolsProtocolHandler::Init));
}
void DevToolsProtocolHandler::Init() {
@@ -38,8 +36,9 @@
}
void DevToolsProtocolHandler::Stop() {
- io_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- this, &DevToolsProtocolHandler::Teardown));
+ ChromeThread::PostTask(
+ ChromeThread::IO, FROM_HERE,
+ NewRunnableMethod(this, &DevToolsProtocolHandler::Teardown));
tool_to_listener_map_.clear(); // Releases all scoped_refptr's to listeners
}
@@ -73,9 +72,11 @@
NOTREACHED(); // an unsupported tool, bail out
return;
}
- DCHECK(MessageLoop::current() == io_loop_);
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- it->second.get(), &DevToolsRemoteListener::HandleMessage, message));
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ it->second.get(), &DevToolsRemoteListener::HandleMessage, message));
}
void DevToolsProtocolHandler::Send(const DevToolsRemoteMessage& message) {
@@ -86,7 +87,7 @@
void DevToolsProtocolHandler::DidAccept(ListenSocket *server,
ListenSocket *connection) {
- DCHECK(MessageLoop::current() == io_loop_);
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
if (connection_ == NULL) {
connection_ = connection;
connection_->AddRef();
@@ -100,7 +101,7 @@
}
void DevToolsProtocolHandler::DidClose(ListenSocket *sock) {
- DCHECK(MessageLoop::current() == io_loop_);
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
DCHECK(connection_ == sock);
connection_ = NULL;
sock->Release();
@@ -108,7 +109,9 @@
end = tool_to_listener_map_.end();
it != end;
++it) {
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(
- it->second.get(), &DevToolsRemoteListener::OnConnectionLost));
+ ChromeThread::PostTask(
+ ChromeThread::UI, FROM_HERE,
+ NewRunnableMethod(
+ it->second.get(), &DevToolsRemoteListener::OnConnectionLost));
}
}
Property changes on: chrome\browser\debugger\devtools_protocol_handler.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/debugger/devtools_protocol_handler.h ('k') | chrome/browser/dom_ui/new_tab_ui_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698