Commit 13260d58 authored by mostynb's avatar mostynb Committed by Commit bot

favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/devtools

BUG=466848

Review URL: https://codereview.chromium.org/1030263002

Cr-Commit-Position: refs/heads/master@{#322339}
parent 419f2d3d
...@@ -433,14 +433,14 @@ AndroidDeviceManager::HandlerThread::instance_ = NULL; ...@@ -433,14 +433,14 @@ AndroidDeviceManager::HandlerThread::instance_ = NULL;
// static // static
scoped_refptr<AndroidDeviceManager::HandlerThread> scoped_refptr<AndroidDeviceManager::HandlerThread>
AndroidDeviceManager::HandlerThread::GetInstance() { AndroidDeviceManager::HandlerThread::GetInstance() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!instance_) if (!instance_)
new HandlerThread(); new HandlerThread();
return instance_; return instance_;
} }
AndroidDeviceManager::HandlerThread::HandlerThread() { AndroidDeviceManager::HandlerThread::HandlerThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
instance_ = this; instance_ = this;
thread_ = new base::Thread(kDevToolsAdbBridgeThreadName); thread_ = new base::Thread(kDevToolsAdbBridgeThreadName);
base::Thread::Options options; base::Thread::Options options;
...@@ -463,7 +463,7 @@ void AndroidDeviceManager::HandlerThread::StopThread( ...@@ -463,7 +463,7 @@ void AndroidDeviceManager::HandlerThread::StopThread(
} }
AndroidDeviceManager::HandlerThread::~HandlerThread() { AndroidDeviceManager::HandlerThread::~HandlerThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
instance_ = NULL; instance_ = NULL;
if (!thread_) if (!thread_)
return; return;
......
...@@ -140,7 +140,7 @@ AndroidDeviceManager::AndroidWebSocket::AndroidWebSocket( ...@@ -140,7 +140,7 @@ AndroidDeviceManager::AndroidWebSocket::AndroidWebSocket(
socket_impl_(nullptr), socket_impl_(nullptr),
delegate_(delegate), delegate_(delegate),
weak_factory_(this) { weak_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(delegate_); DCHECK(delegate_);
DCHECK(device_); DCHECK(device_);
device_->sockets_.insert(this); device_->sockets_.insert(this);
...@@ -150,13 +150,13 @@ AndroidDeviceManager::AndroidWebSocket::AndroidWebSocket( ...@@ -150,13 +150,13 @@ AndroidDeviceManager::AndroidWebSocket::AndroidWebSocket(
} }
AndroidDeviceManager::AndroidWebSocket::~AndroidWebSocket() { AndroidDeviceManager::AndroidWebSocket::~AndroidWebSocket() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
Terminate(); Terminate();
} }
void AndroidDeviceManager::AndroidWebSocket::SendFrame( void AndroidDeviceManager::AndroidWebSocket::SendFrame(
const std::string& message) { const std::string& message) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(socket_impl_); DCHECK(socket_impl_);
DCHECK(device_); DCHECK(device_);
device_->message_loop_proxy_->PostTask( device_->message_loop_proxy_->PostTask(
...@@ -169,7 +169,7 @@ void AndroidDeviceManager::AndroidWebSocket::Connected( ...@@ -169,7 +169,7 @@ void AndroidDeviceManager::AndroidWebSocket::Connected(
int result, int result,
const std::string& extensions, const std::string& extensions,
scoped_ptr<net::StreamSocket> socket) { scoped_ptr<net::StreamSocket> socket) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result != net::OK || !socket.get()) { if (result != net::OK || !socket.get()) {
OnSocketClosed(); OnSocketClosed();
return; return;
...@@ -187,18 +187,18 @@ void AndroidDeviceManager::AndroidWebSocket::Connected( ...@@ -187,18 +187,18 @@ void AndroidDeviceManager::AndroidWebSocket::Connected(
void AndroidDeviceManager::AndroidWebSocket::OnFrameRead( void AndroidDeviceManager::AndroidWebSocket::OnFrameRead(
const std::string& message) { const std::string& message) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
delegate_->OnFrameRead(message); delegate_->OnFrameRead(message);
} }
void AndroidDeviceManager::AndroidWebSocket::OnSocketClosed() { void AndroidDeviceManager::AndroidWebSocket::OnSocketClosed() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
Terminate(); Terminate();
delegate_->OnSocketClosed(); delegate_->OnSocketClosed();
} }
void AndroidDeviceManager::AndroidWebSocket::Terminate() { void AndroidDeviceManager::AndroidWebSocket::Terminate() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (socket_impl_) { if (socket_impl_) {
DCHECK(device_); DCHECK(device_);
device_->message_loop_proxy_->DeleteSoon(FROM_HERE, socket_impl_); device_->message_loop_proxy_->DeleteSoon(FROM_HERE, socket_impl_);
......
...@@ -114,19 +114,19 @@ DevToolsAndroidBridge::DiscoveryRequest::DiscoveryRequest( ...@@ -114,19 +114,19 @@ DevToolsAndroidBridge::DiscoveryRequest::DiscoveryRequest(
AndroidDeviceManager* device_manager, AndroidDeviceManager* device_manager,
const DeviceListCallback& callback) const DeviceListCallback& callback)
: callback_(callback) { : callback_(callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
device_manager->QueryDevices( device_manager->QueryDevices(
base::Bind(&DiscoveryRequest::ReceivedDevices, this)); base::Bind(&DiscoveryRequest::ReceivedDevices, this));
} }
DevToolsAndroidBridge::DiscoveryRequest::~DiscoveryRequest() { DevToolsAndroidBridge::DiscoveryRequest::~DiscoveryRequest() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
callback_.Run(complete_devices_); callback_.Run(complete_devices_);
} }
void DevToolsAndroidBridge::DiscoveryRequest::ReceivedDevices( void DevToolsAndroidBridge::DiscoveryRequest::ReceivedDevices(
const AndroidDeviceManager::Devices& devices) { const AndroidDeviceManager::Devices& devices) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (const auto& device : devices) { for (const auto& device : devices) {
device->QueryDeviceInfo( device->QueryDeviceInfo(
base::Bind(&DiscoveryRequest::ReceivedDeviceInfo, this, device)); base::Bind(&DiscoveryRequest::ReceivedDeviceInfo, this, device));
...@@ -136,7 +136,7 @@ void DevToolsAndroidBridge::DiscoveryRequest::ReceivedDevices( ...@@ -136,7 +136,7 @@ void DevToolsAndroidBridge::DiscoveryRequest::ReceivedDevices(
void DevToolsAndroidBridge::DiscoveryRequest::ReceivedDeviceInfo( void DevToolsAndroidBridge::DiscoveryRequest::ReceivedDeviceInfo(
scoped_refptr<AndroidDeviceManager::Device> device, scoped_refptr<AndroidDeviceManager::Device> device,
const AndroidDeviceManager::DeviceInfo& device_info) { const AndroidDeviceManager::DeviceInfo& device_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_refptr<RemoteDevice> remote_device = scoped_refptr<RemoteDevice> remote_device =
new RemoteDevice(device->serial(), device_info); new RemoteDevice(device->serial(), device_info);
complete_devices_.push_back(std::make_pair(device, remote_device)); complete_devices_.push_back(std::make_pair(device, remote_device));
...@@ -157,7 +157,7 @@ void DevToolsAndroidBridge::DiscoveryRequest::ReceivedVersion( ...@@ -157,7 +157,7 @@ void DevToolsAndroidBridge::DiscoveryRequest::ReceivedVersion(
scoped_refptr<RemoteBrowser> browser, scoped_refptr<RemoteBrowser> browser,
int result, int result,
const std::string& response) { const std::string& response) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result < 0) if (result < 0)
return; return;
// Parse version, append to package name if available, // Parse version, append to package name if available,
...@@ -185,7 +185,7 @@ void DevToolsAndroidBridge::DiscoveryRequest::ReceivedPages( ...@@ -185,7 +185,7 @@ void DevToolsAndroidBridge::DiscoveryRequest::ReceivedPages(
scoped_refptr<RemoteBrowser> browser, scoped_refptr<RemoteBrowser> browser,
int result, int result,
const std::string& response) { const std::string& response) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result < 0) if (result < 0)
return; return;
scoped_ptr<base::Value> value(base::JSONReader::Read(response)); scoped_ptr<base::Value> value(base::JSONReader::Read(response));
...@@ -348,7 +348,7 @@ DevToolsAndroidBridge::AgentHostDelegate::GetOrCreateAgentHost( ...@@ -348,7 +348,7 @@ DevToolsAndroidBridge::AgentHostDelegate::GetOrCreateAgentHost(
const BrowserId& browser_id, const BrowserId& browser_id,
const std::string& debug_url, const std::string& debug_url,
bool is_web_view) { bool is_web_view) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
AgentHostDelegates::iterator it = bridge->host_delegates_.find(id); AgentHostDelegates::iterator it = bridge->host_delegates_.find(id);
if (it != bridge->host_delegates_.end()) if (it != bridge->host_delegates_.end())
return it->second->agent_host_; return it->second->agent_host_;
...@@ -662,7 +662,7 @@ void DevToolsAndroidBridge::SendProtocolCommand( ...@@ -662,7 +662,7 @@ void DevToolsAndroidBridge::SendProtocolCommand(
const std::string& method, const std::string& method,
scoped_ptr<base::DictionaryValue> params, scoped_ptr<base::DictionaryValue> params,
const base::Closure callback) { const base::Closure callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (debug_url.empty()) if (debug_url.empty())
return; return;
scoped_refptr<AndroidDeviceManager::Device> device( scoped_refptr<AndroidDeviceManager::Device> device(
...@@ -711,7 +711,7 @@ void DevToolsAndroidBridge::RespondToOpenOnUIThread( ...@@ -711,7 +711,7 @@ void DevToolsAndroidBridge::RespondToOpenOnUIThread(
const RemotePageCallback& callback, const RemotePageCallback& callback,
int result, int result,
const std::string& response) { const std::string& response) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result < 0) { if (result < 0) {
callback.Run(NULL); callback.Run(NULL);
return; return;
...@@ -729,7 +729,7 @@ void DevToolsAndroidBridge::OpenRemotePage( ...@@ -729,7 +729,7 @@ void DevToolsAndroidBridge::OpenRemotePage(
scoped_refptr<RemoteBrowser> browser, scoped_refptr<RemoteBrowser> browser,
const std::string& input_url, const std::string& input_url,
const DevToolsAndroidBridge::RemotePageCallback& callback) { const DevToolsAndroidBridge::RemotePageCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
GURL gurl(input_url); GURL gurl(input_url);
if (!gurl.is_valid()) { if (!gurl.is_valid()) {
gurl = GURL("http://" + input_url); gurl = GURL("http://" + input_url);
...@@ -761,7 +761,7 @@ void DevToolsAndroidBridge::PageCreatedOnUIThread( ...@@ -761,7 +761,7 @@ void DevToolsAndroidBridge::PageCreatedOnUIThread(
const std::string& url, const std::string& url,
int result, int result,
const std::string& response) { const std::string& response) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (result < 0) if (result < 0)
return; return;
...@@ -780,7 +780,7 @@ void DevToolsAndroidBridge::NavigatePageOnUIThread( ...@@ -780,7 +780,7 @@ void DevToolsAndroidBridge::NavigatePageOnUIThread(
int result, int result,
const std::string& response, const std::string& response,
const std::string& url) { const std::string& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_ptr<base::Value> value(base::JSONReader::Read(response)); scoped_ptr<base::Value> value(base::JSONReader::Read(response));
base::DictionaryValue* dict; base::DictionaryValue* dict;
...@@ -829,7 +829,7 @@ DevToolsAndroidBridge::DevToolsAndroidBridge( ...@@ -829,7 +829,7 @@ DevToolsAndroidBridge::DevToolsAndroidBridge(
task_scheduler_(base::Bind(&DevToolsAndroidBridge::ScheduleTaskDefault)), task_scheduler_(base::Bind(&DevToolsAndroidBridge::ScheduleTaskDefault)),
port_forwarding_controller_(new PortForwardingController(profile, this)), port_forwarding_controller_(new PortForwardingController(profile, this)),
weak_factory_(this) { weak_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
pref_change_registrar_.Init(profile_->GetPrefs()); pref_change_registrar_.Init(profile_->GetPrefs());
pref_change_registrar_.Add(prefs::kDevToolsDiscoverUsbDevicesEnabled, pref_change_registrar_.Add(prefs::kDevToolsDiscoverUsbDevicesEnabled,
base::Bind(&DevToolsAndroidBridge::CreateDeviceProviders, base::Bind(&DevToolsAndroidBridge::CreateDeviceProviders,
...@@ -839,7 +839,7 @@ DevToolsAndroidBridge::DevToolsAndroidBridge( ...@@ -839,7 +839,7 @@ DevToolsAndroidBridge::DevToolsAndroidBridge(
void DevToolsAndroidBridge::AddDeviceListListener( void DevToolsAndroidBridge::AddDeviceListListener(
DeviceListListener* listener) { DeviceListListener* listener) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
bool polling_was_off = !NeedsDeviceListPolling(); bool polling_was_off = !NeedsDeviceListPolling();
device_list_listeners_.push_back(listener); device_list_listeners_.push_back(listener);
if (polling_was_off) if (polling_was_off)
...@@ -848,7 +848,7 @@ void DevToolsAndroidBridge::AddDeviceListListener( ...@@ -848,7 +848,7 @@ void DevToolsAndroidBridge::AddDeviceListListener(
void DevToolsAndroidBridge::RemoveDeviceListListener( void DevToolsAndroidBridge::RemoveDeviceListListener(
DeviceListListener* listener) { DeviceListListener* listener) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DeviceListListeners::iterator it = std::find( DeviceListListeners::iterator it = std::find(
device_list_listeners_.begin(), device_list_listeners_.end(), listener); device_list_listeners_.begin(), device_list_listeners_.end(), listener);
DCHECK(it != device_list_listeners_.end()); DCHECK(it != device_list_listeners_.end());
...@@ -866,7 +866,7 @@ void DevToolsAndroidBridge::AddDeviceCountListener( ...@@ -866,7 +866,7 @@ void DevToolsAndroidBridge::AddDeviceCountListener(
void DevToolsAndroidBridge::RemoveDeviceCountListener( void DevToolsAndroidBridge::RemoveDeviceCountListener(
DeviceCountListener* listener) { DeviceCountListener* listener) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DeviceCountListeners::iterator it = std::find( DeviceCountListeners::iterator it = std::find(
device_count_listeners_.begin(), device_count_listeners_.end(), listener); device_count_listeners_.begin(), device_count_listeners_.end(), listener);
DCHECK(it != device_count_listeners_.end()); DCHECK(it != device_count_listeners_.end());
...@@ -896,12 +896,12 @@ void DevToolsAndroidBridge::RemovePortForwardingListener( ...@@ -896,12 +896,12 @@ void DevToolsAndroidBridge::RemovePortForwardingListener(
} }
bool DevToolsAndroidBridge::HasDevToolsWindow(const std::string& agent_id) { bool DevToolsAndroidBridge::HasDevToolsWindow(const std::string& agent_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
return host_delegates_.find(agent_id) != host_delegates_.end(); return host_delegates_.find(agent_id) != host_delegates_.end();
} }
DevToolsAndroidBridge::~DevToolsAndroidBridge() { DevToolsAndroidBridge::~DevToolsAndroidBridge() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(device_list_listeners_.empty()); DCHECK(device_list_listeners_.empty());
DCHECK(device_count_listeners_.empty()); DCHECK(device_count_listeners_.empty());
DCHECK(port_forwarding_listeners_.empty()); DCHECK(port_forwarding_listeners_.empty());
...@@ -924,7 +924,7 @@ bool DevToolsAndroidBridge::NeedsDeviceListPolling() { ...@@ -924,7 +924,7 @@ bool DevToolsAndroidBridge::NeedsDeviceListPolling() {
void DevToolsAndroidBridge::RequestDeviceList( void DevToolsAndroidBridge::RequestDeviceList(
const DeviceListCallback& callback) { const DeviceListCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!NeedsDeviceListPolling() || if (!NeedsDeviceListPolling() ||
!callback.Equals(device_list_callback_.callback())) !callback.Equals(device_list_callback_.callback()))
...@@ -935,7 +935,7 @@ void DevToolsAndroidBridge::RequestDeviceList( ...@@ -935,7 +935,7 @@ void DevToolsAndroidBridge::RequestDeviceList(
void DevToolsAndroidBridge::ReceivedDeviceList( void DevToolsAndroidBridge::ReceivedDeviceList(
const CompleteDevices& complete_devices) { const CompleteDevices& complete_devices) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
device_map_.clear(); device_map_.clear();
RemoteDevices remote_devices; RemoteDevices remote_devices;
...@@ -976,7 +976,7 @@ void DevToolsAndroidBridge::StopDeviceCountPolling() { ...@@ -976,7 +976,7 @@ void DevToolsAndroidBridge::StopDeviceCountPolling() {
void DevToolsAndroidBridge::RequestDeviceCount( void DevToolsAndroidBridge::RequestDeviceCount(
const base::Callback<void(int)>& callback) { const base::Callback<void(int)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (device_count_listeners_.empty() || if (device_count_listeners_.empty() ||
!callback.Equals(device_count_callback_.callback())) !callback.Equals(device_count_callback_.callback()))
...@@ -986,7 +986,7 @@ void DevToolsAndroidBridge::RequestDeviceCount( ...@@ -986,7 +986,7 @@ void DevToolsAndroidBridge::RequestDeviceCount(
} }
void DevToolsAndroidBridge::ReceivedDeviceCount(int count) { void DevToolsAndroidBridge::ReceivedDeviceCount(int count) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DeviceCountListeners copy(device_count_listeners_); DeviceCountListeners copy(device_count_listeners_);
for (DeviceCountListeners::iterator it = copy.begin(); it != copy.end(); ++it) for (DeviceCountListeners::iterator it = copy.begin(); it != copy.end(); ++it)
......
...@@ -323,7 +323,7 @@ PortForwardingController::Connection::Connection( ...@@ -323,7 +323,7 @@ PortForwardingController::Connection::Connection(
connected_(false), connected_(false),
forwarding_map_(forwarding_map), forwarding_map_(forwarding_map),
weak_factory_(this) { weak_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
controller_->registry_[browser->serial()] = this; controller_->registry_[browser->serial()] = this;
scoped_refptr<AndroidDeviceManager::Device> device( scoped_refptr<AndroidDeviceManager::Device> device(
controller_->bridge_->FindDevice(browser->serial())); controller_->bridge_->FindDevice(browser->serial()));
...@@ -334,7 +334,7 @@ PortForwardingController::Connection::Connection( ...@@ -334,7 +334,7 @@ PortForwardingController::Connection::Connection(
} }
PortForwardingController::Connection::~Connection() { PortForwardingController::Connection::~Connection() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(controller_->registry_.find(browser_->serial()) != DCHECK(controller_->registry_.find(browser_->serial()) !=
controller_->registry_.end()); controller_->registry_.end());
controller_->registry_.erase(browser_->serial()); controller_->registry_.erase(browser_->serial());
...@@ -342,7 +342,7 @@ PortForwardingController::Connection::~Connection() { ...@@ -342,7 +342,7 @@ PortForwardingController::Connection::~Connection() {
void PortForwardingController::Connection::UpdateForwardingMap( void PortForwardingController::Connection::UpdateForwardingMap(
const ForwardingMap& new_forwarding_map) { const ForwardingMap& new_forwarding_map) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (connected_) { if (connected_) {
SerializeChanges(tethering::unbind::kName, SerializeChanges(tethering::unbind::kName,
new_forwarding_map, forwarding_map_); new_forwarding_map, forwarding_map_);
...@@ -356,7 +356,7 @@ void PortForwardingController::Connection::SerializeChanges( ...@@ -356,7 +356,7 @@ void PortForwardingController::Connection::SerializeChanges(
const std::string& method, const std::string& method,
const ForwardingMap& old_map, const ForwardingMap& old_map,
const ForwardingMap& new_map) { const ForwardingMap& new_map) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (ForwardingMap::const_iterator new_it(new_map.begin()); for (ForwardingMap::const_iterator new_it(new_map.begin());
new_it != new_map.end(); ++new_it) { new_it != new_map.end(); ++new_it) {
int port = new_it->first; int port = new_it->first;
...@@ -371,7 +371,7 @@ void PortForwardingController::Connection::SerializeChanges( ...@@ -371,7 +371,7 @@ void PortForwardingController::Connection::SerializeChanges(
void PortForwardingController::Connection::SendCommand( void PortForwardingController::Connection::SendCommand(
const std::string& method, int port) { const std::string& method, int port) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue); scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue);
if (method == tethering::bind::kName) { if (method == tethering::bind::kName) {
params->SetInteger(tethering::bind::kParamPort, port); params->SetInteger(tethering::bind::kParamPort, port);
...@@ -451,7 +451,7 @@ void PortForwardingController::Connection::UpdateSocketCountOnHandlerThread( ...@@ -451,7 +451,7 @@ void PortForwardingController::Connection::UpdateSocketCountOnHandlerThread(
void PortForwardingController::Connection::UpdateSocketCount( void PortForwardingController::Connection::UpdateSocketCount(
int port, int increment) { int port, int increment) {
#if defined(DEBUG_DEVTOOLS) #if defined(DEBUG_DEVTOOLS)
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
PortStatusMap::iterator it = port_status_.find(port); PortStatusMap::iterator it = port_status_.find(port);
if (it == port_status_.end()) if (it == port_status_.end())
return; return;
...@@ -463,12 +463,12 @@ void PortForwardingController::Connection::UpdateSocketCount( ...@@ -463,12 +463,12 @@ void PortForwardingController::Connection::UpdateSocketCount(
const PortForwardingController::PortStatusMap& const PortForwardingController::PortStatusMap&
PortForwardingController::Connection::GetPortStatusMap() { PortForwardingController::Connection::GetPortStatusMap() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
return port_status_; return port_status_;
} }
void PortForwardingController::Connection::OnSocketOpened() { void PortForwardingController::Connection::OnSocketOpened() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
connected_ = true; connected_ = true;
SerializeChanges(tethering::bind::kName, ForwardingMap(), forwarding_map_); SerializeChanges(tethering::bind::kName, ForwardingMap(), forwarding_map_);
} }
...@@ -479,7 +479,7 @@ void PortForwardingController::Connection::OnSocketClosed() { ...@@ -479,7 +479,7 @@ void PortForwardingController::Connection::OnSocketClosed() {
void PortForwardingController::Connection::OnFrameRead( void PortForwardingController::Connection::OnFrameRead(
const std::string& message) { const std::string& message) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (ProcessResponse(message)) if (ProcessResponse(message))
return; return;
......
...@@ -586,7 +586,7 @@ class AndroidUsbDiscoveryTest : public InProcessBrowserTest { ...@@ -586,7 +586,7 @@ class AndroidUsbDiscoveryTest : public InProcessBrowserTest {
} }
void ScheduleDeviceCountRequest(const base::Closure& request) { void ScheduleDeviceCountRequest(const base::Closure& request) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
scheduler_invoked_++; scheduler_invoked_++;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, request); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, request);
} }
...@@ -690,7 +690,7 @@ class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener { ...@@ -690,7 +690,7 @@ class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener {
}; };
void ShutdownOnUIThread() { void ShutdownOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (reposts_left_-- == 0) { if (reposts_left_-- == 0) {
base::MessageLoop::current()->Quit(); base::MessageLoop::current()->Quit();
} else { } else {
...@@ -703,7 +703,7 @@ class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener { ...@@ -703,7 +703,7 @@ class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener {
} }
void ShutdownOnFileThread() { void ShutdownOnFileThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
BrowserThread::PostTask(BrowserThread::UI, BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE, FROM_HERE,
base::Bind(&MockCountListener::ShutdownOnUIThread, base::Bind(&MockCountListener::ShutdownOnUIThread,
......
...@@ -180,7 +180,7 @@ static void RespondOnFileThread( ...@@ -180,7 +180,7 @@ static void RespondOnFileThread(
const AndroidUsbDevicesCallback& callback, const AndroidUsbDevicesCallback& callback,
AndroidUsbDevices* devices, AndroidUsbDevices* devices,
scoped_refptr<base::MessageLoopProxy> caller_message_loop_proxy) { scoped_refptr<base::MessageLoopProxy> caller_message_loop_proxy) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
caller_message_loop_proxy->PostTask( caller_message_loop_proxy->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&RespondOnCallerThread, callback, devices)); base::Bind(&RespondOnCallerThread, callback, devices));
...@@ -193,7 +193,7 @@ static void OpenAndroidDeviceOnFileThread( ...@@ -193,7 +193,7 @@ static void OpenAndroidDeviceOnFileThread(
scoped_refptr<UsbDevice> device, scoped_refptr<UsbDevice> device,
int interface_id, int interface_id,
bool success) { bool success) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (success) { if (success) {
base::string16 serial; base::string16 serial;
if (device->GetSerialNumber(&serial) && !serial.empty()) { if (device->GetSerialNumber(&serial) && !serial.empty()) {
...@@ -215,7 +215,7 @@ static void OpenAndroidDeviceOnFileThread( ...@@ -215,7 +215,7 @@ static void OpenAndroidDeviceOnFileThread(
} }
static int CountOnFileThread() { static int CountOnFileThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
UsbService* service = device::DeviceClient::Get()->GetUsbService(); UsbService* service = device::DeviceClient::Get()->GetUsbService();
UsbDevices usb_devices; UsbDevices usb_devices;
if (service != NULL) if (service != NULL)
...@@ -238,7 +238,7 @@ static void EnumerateOnFileThread( ...@@ -238,7 +238,7 @@ static void EnumerateOnFileThread(
crypto::RSAPrivateKey* rsa_key, crypto::RSAPrivateKey* rsa_key,
const AndroidUsbDevicesCallback& callback, const AndroidUsbDevicesCallback& callback,
scoped_refptr<base::MessageLoopProxy> caller_message_loop_proxy) { scoped_refptr<base::MessageLoopProxy> caller_message_loop_proxy) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
UsbService* service = device::DeviceClient::Get()->GetUsbService(); UsbService* service = device::DeviceClient::Get()->GetUsbService();
UsbDevices usb_devices; UsbDevices usb_devices;
...@@ -612,7 +612,7 @@ void AndroidUsbDevice::TransferError(UsbTransferStatus status) { ...@@ -612,7 +612,7 @@ void AndroidUsbDevice::TransferError(UsbTransferStatus status) {
void AndroidUsbDevice::TerminateIfReleased( void AndroidUsbDevice::TerminateIfReleased(
scoped_refptr<UsbDeviceHandle> usb_handle) { scoped_refptr<UsbDeviceHandle> usb_handle) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (usb_handle->GetDevice().get()) if (usb_handle->GetDevice().get())
return; return;
message_loop_->PostTask(FROM_HERE, message_loop_->PostTask(FROM_HERE,
......
...@@ -52,7 +52,7 @@ base::WeakPtr<DevToolsBridgeClient> DevToolsBridgeClient::Create( ...@@ -52,7 +52,7 @@ base::WeakPtr<DevToolsBridgeClient> DevToolsBridgeClient::Create(
Profile* profile, Profile* profile,
SigninManagerBase* signin_manager, SigninManagerBase* signin_manager,
ProfileOAuth2TokenService* token_service) { ProfileOAuth2TokenService* token_service) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto instance = auto instance =
new DevToolsBridgeClient(profile, signin_manager, token_service); new DevToolsBridgeClient(profile, signin_manager, token_service);
return instance->weak_factory_.GetWeakPtr(); return instance->weak_factory_.GetWeakPtr();
...@@ -67,7 +67,7 @@ DevToolsBridgeClient::DevToolsBridgeClient( ...@@ -67,7 +67,7 @@ DevToolsBridgeClient::DevToolsBridgeClient(
identity_provider_(signin_manager, token_service, nullptr), identity_provider_(signin_manager, token_service, nullptr),
worker_is_loaded_(false), worker_is_loaded_(false),
weak_factory_(this) { weak_factory_(this) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
identity_provider_.AddObserver(this); identity_provider_.AddObserver(this);
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
...@@ -78,13 +78,13 @@ DevToolsBridgeClient::DevToolsBridgeClient( ...@@ -78,13 +78,13 @@ DevToolsBridgeClient::DevToolsBridgeClient(
} }
DevToolsBridgeClient::~DevToolsBridgeClient() { DevToolsBridgeClient::~DevToolsBridgeClient() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
identity_provider_.RemoveObserver(this); identity_provider_.RemoveObserver(this);
} }
void DevToolsBridgeClient::DeleteSelf() { void DevToolsBridgeClient::DeleteSelf() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
delete this; delete this;
} }
...@@ -178,7 +178,7 @@ DevToolsBridgeClient::DeviceInfo DevToolsBridgeClient::GetDeviceInfo( ...@@ -178,7 +178,7 @@ DevToolsBridgeClient::DeviceInfo DevToolsBridgeClient::GetDeviceInfo(
} }
void DevToolsBridgeClient::CreateBackgroundWorker() { void DevToolsBridgeClient::CreateBackgroundWorker() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
background_worker_.reset( background_worker_.reset(
WebContents::Create(WebContents::CreateParams(profile_))); WebContents::Create(WebContents::CreateParams(profile_)));
...@@ -204,19 +204,19 @@ void DevToolsBridgeClient::Observe( ...@@ -204,19 +204,19 @@ void DevToolsBridgeClient::Observe(
int type, int type,
const content::NotificationSource& source, const content::NotificationSource& source,
const content::NotificationDetails& details) { const content::NotificationDetails& details) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type);
delete this; delete this;
} }
void DevToolsBridgeClient::OnActiveAccountLogin() { void DevToolsBridgeClient::OnActiveAccountLogin() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
CreateBackgroundWorker(); CreateBackgroundWorker();
} }
void DevToolsBridgeClient::OnActiveAccountLogout() { void DevToolsBridgeClient::OnActiveAccountLogout() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
background_worker_.reset(); background_worker_.reset();
browser_list_request_.reset(); browser_list_request_.reset();
send_command_request_.reset(); send_command_request_.reset();
......
...@@ -118,21 +118,21 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener, ...@@ -118,21 +118,21 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener,
}; };
void WriteToFile(const base::FilePath& path, const std::string& content) { void WriteToFile(const base::FilePath& path, const std::string& content) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!path.empty()); DCHECK(!path.empty());
base::WriteFile(path, content.c_str(), content.length()); base::WriteFile(path, content.c_str(), content.length());
} }
void AppendToFile(const base::FilePath& path, const std::string& content) { void AppendToFile(const base::FilePath& path, const std::string& content) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!path.empty()); DCHECK(!path.empty());
base::AppendToFile(path, content.c_str(), content.size()); base::AppendToFile(path, content.c_str(), content.size());
} }
storage::IsolatedContext* isolated_context() { storage::IsolatedContext* isolated_context() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
storage::IsolatedContext* isolated_context = storage::IsolatedContext* isolated_context =
storage::IsolatedContext::GetInstance(); storage::IsolatedContext::GetInstance();
DCHECK(isolated_context); DCHECK(isolated_context);
...@@ -142,7 +142,7 @@ storage::IsolatedContext* isolated_context() { ...@@ -142,7 +142,7 @@ storage::IsolatedContext* isolated_context() {
std::string RegisterFileSystem(WebContents* web_contents, std::string RegisterFileSystem(WebContents* web_contents,
const base::FilePath& path, const base::FilePath& path,
std::string* registered_name) { std::string* registered_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
CHECK(web_contents->GetURL().SchemeIs(content::kChromeDevToolsScheme)); CHECK(web_contents->GetURL().SchemeIs(content::kChromeDevToolsScheme));
std::string file_system_id = isolated_context()->RegisterFileSystemForPath( std::string file_system_id = isolated_context()->RegisterFileSystemForPath(
storage::kFileSystemTypeNativeLocal, storage::kFileSystemTypeNativeLocal,
...@@ -410,7 +410,7 @@ void DevToolsFileHelper::RequestFileSystems( ...@@ -410,7 +410,7 @@ void DevToolsFileHelper::RequestFileSystems(
} }
void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) { void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path);
isolated_context()->RevokeFileSystemByPath(path); isolated_context()->RevokeFileSystemByPath(path);
...@@ -422,7 +422,7 @@ void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) { ...@@ -422,7 +422,7 @@ void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) {
bool DevToolsFileHelper::IsFileSystemAdded( bool DevToolsFileHelper::IsFileSystemAdded(
const std::string& file_system_path) { const std::string& file_system_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_);
return file_system_paths.find(file_system_path) != file_system_paths.end(); return file_system_paths.find(file_system_path) != file_system_paths.end();
} }
...@@ -137,7 +137,7 @@ Index::Index() : last_file_id_(0) { ...@@ -137,7 +137,7 @@ Index::Index() : last_file_id_(0) {
Index::~Index() {} Index::~Index() {}
Time Index::LastModifiedTimeForFile(const FilePath& file_path) { Time Index::LastModifiedTimeForFile(const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
Time last_modified_time; Time last_modified_time;
if (index_times_.find(file_path) != index_times_.end()) if (index_times_.find(file_path) != index_times_.end())
last_modified_time = index_times_[file_path]; last_modified_time = index_times_[file_path];
...@@ -147,7 +147,7 @@ Time Index::LastModifiedTimeForFile(const FilePath& file_path) { ...@@ -147,7 +147,7 @@ Time Index::LastModifiedTimeForFile(const FilePath& file_path) {
void Index::SetTrigramsForFile(const FilePath& file_path, void Index::SetTrigramsForFile(const FilePath& file_path,
const vector<Trigram>& index, const vector<Trigram>& index,
const Time& time) { const Time& time) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
FileId file_id = GetFileId(file_path); FileId file_id = GetFileId(file_path);
vector<Trigram>::const_iterator it = index.begin(); vector<Trigram>::const_iterator it = index.begin();
for (; it != index.end(); ++it) { for (; it != index.end(); ++it) {
...@@ -159,7 +159,7 @@ void Index::SetTrigramsForFile(const FilePath& file_path, ...@@ -159,7 +159,7 @@ void Index::SetTrigramsForFile(const FilePath& file_path,
} }
vector<FilePath> Index::Search(string query) { vector<FilePath> Index::Search(string query) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
const char* data = query.c_str(); const char* data = query.c_str();
vector<TrigramChar> trigram_chars; vector<TrigramChar> trigram_chars;
trigram_chars.reserve(query.size()); trigram_chars.reserve(query.size());
...@@ -203,7 +203,7 @@ vector<FilePath> Index::Search(string query) { ...@@ -203,7 +203,7 @@ vector<FilePath> Index::Search(string query) {
} }
FileId Index::GetFileId(const FilePath& file_path) { FileId Index::GetFileId(const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
string file_path_str = file_path.AsUTF8Unsafe(); string file_path_str = file_path.AsUTF8Unsafe();
if (file_ids_.find(file_path) != file_ids_.end()) if (file_ids_.find(file_path) != file_ids_.end())
return file_ids_[file_path]; return file_ids_[file_path];
...@@ -212,7 +212,7 @@ FileId Index::GetFileId(const FilePath& file_path) { ...@@ -212,7 +212,7 @@ FileId Index::GetFileId(const FilePath& file_path) {
} }
void Index::NormalizeVectors() { void Index::NormalizeVectors() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
for (size_t i = 0; i < kTrigramCount; ++i) { for (size_t i = 0; i < kTrigramCount; ++i) {
if (!is_normalized_[i]) { if (!is_normalized_[i]) {
std::sort(index_[i].begin(), index_[i].end()); std::sort(index_[i].begin(), index_[i].end());
...@@ -224,7 +224,7 @@ void Index::NormalizeVectors() { ...@@ -224,7 +224,7 @@ void Index::NormalizeVectors() {
} }
void Index::PrintStats() { void Index::PrintStats() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
LOG(ERROR) << "Index stats:"; LOG(ERROR) << "Index stats:";
size_t size = 0; size_t size = 0;
size_t maxSize = 0; size_t maxSize = 0;
...@@ -267,7 +267,7 @@ DevToolsFileSystemIndexer::FileSystemIndexingJob::FileSystemIndexingJob( ...@@ -267,7 +267,7 @@ DevToolsFileSystemIndexer::FileSystemIndexingJob::FileSystemIndexingJob(
DevToolsFileSystemIndexer::FileSystemIndexingJob::~FileSystemIndexingJob() {} DevToolsFileSystemIndexer::FileSystemIndexingJob::~FileSystemIndexingJob() {}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() { void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::FILE, BrowserThread::FILE,
FROM_HERE, FROM_HERE,
...@@ -275,7 +275,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() { ...@@ -275,7 +275,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::Start() {
} }
void DevToolsFileSystemIndexer::FileSystemIndexingJob::Stop() { void DevToolsFileSystemIndexer::FileSystemIndexingJob::Stop() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserThread::PostTask(BrowserThread::FILE, BrowserThread::PostTask(BrowserThread::FILE,
FROM_HERE, FROM_HERE,
Bind(&FileSystemIndexingJob::StopOnFileThread, this)); Bind(&FileSystemIndexingJob::StopOnFileThread, this));
...@@ -286,7 +286,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::StopOnFileThread() { ...@@ -286,7 +286,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::StopOnFileThread() {
} }
void DevToolsFileSystemIndexer::FileSystemIndexingJob::CollectFilesToIndex() { void DevToolsFileSystemIndexer::FileSystemIndexingJob::CollectFilesToIndex() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (stopped_) if (stopped_)
return; return;
if (!file_enumerator_) { if (!file_enumerator_) {
...@@ -317,7 +317,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::CollectFilesToIndex() { ...@@ -317,7 +317,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::CollectFilesToIndex() {
} }
void DevToolsFileSystemIndexer::FileSystemIndexingJob::IndexFiles() { void DevToolsFileSystemIndexer::FileSystemIndexingJob::IndexFiles() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (stopped_) if (stopped_)
return; return;
if (indexing_it_ == file_path_times_.end()) { if (indexing_it_ == file_path_times_.end()) {
...@@ -393,7 +393,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::OnRead( ...@@ -393,7 +393,7 @@ void DevToolsFileSystemIndexer::FileSystemIndexingJob::OnRead(
void DevToolsFileSystemIndexer::FileSystemIndexingJob::FinishFileIndexing( void DevToolsFileSystemIndexer::FileSystemIndexingJob::FinishFileIndexing(
bool success) { bool success) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
CloseFile(); CloseFile();
if (success) { if (success) {
FilePath file_path = indexing_it_->first; FilePath file_path = indexing_it_->first;
...@@ -441,7 +441,7 @@ DevToolsFileSystemIndexer::IndexPath( ...@@ -441,7 +441,7 @@ DevToolsFileSystemIndexer::IndexPath(
const TotalWorkCallback& total_work_callback, const TotalWorkCallback& total_work_callback,
const WorkedCallback& worked_callback, const WorkedCallback& worked_callback,
const DoneCallback& done_callback) { const DoneCallback& done_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
scoped_refptr<FileSystemIndexingJob> indexing_job = scoped_refptr<FileSystemIndexingJob> indexing_job =
new FileSystemIndexingJob(FilePath::FromUTF8Unsafe(file_system_path), new FileSystemIndexingJob(FilePath::FromUTF8Unsafe(file_system_path),
total_work_callback, total_work_callback,
...@@ -454,7 +454,7 @@ DevToolsFileSystemIndexer::IndexPath( ...@@ -454,7 +454,7 @@ DevToolsFileSystemIndexer::IndexPath(
void DevToolsFileSystemIndexer::SearchInPath(const string& file_system_path, void DevToolsFileSystemIndexer::SearchInPath(const string& file_system_path,
const string& query, const string& query,
const SearchCallback& callback) { const SearchCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::FILE, BrowserThread::FILE,
FROM_HERE, FROM_HERE,
...@@ -469,7 +469,7 @@ void DevToolsFileSystemIndexer::SearchInPathOnFileThread( ...@@ -469,7 +469,7 @@ void DevToolsFileSystemIndexer::SearchInPathOnFileThread(
const string& file_system_path, const string& file_system_path,
const string& query, const string& query,
const SearchCallback& callback) { const SearchCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK_CURRENTLY_ON(BrowserThread::FILE);
vector<FilePath> file_paths = g_trigram_index.Get().Search(query); vector<FilePath> file_paths = g_trigram_index.Get().Search(query);
vector<string> result; vector<string> result;
FilePath path = FilePath::FromUTF8Unsafe(file_system_path); FilePath path = FilePath::FromUTF8Unsafe(file_system_path);
......
...@@ -272,7 +272,7 @@ scoped_ptr<DevToolsTargetImpl> DevToolsTargetImpl::CreateForWebContents( ...@@ -272,7 +272,7 @@ scoped_ptr<DevToolsTargetImpl> DevToolsTargetImpl::CreateForWebContents(
// static // static
void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
std::set<WebContents*> tab_web_contents; std::set<WebContents*> tab_web_contents;
for (TabContentsIterator it; !it.done(); it.Next()) for (TabContentsIterator it; !it.done(); it.Next())
......
...@@ -132,14 +132,14 @@ class WorkerObserver ...@@ -132,14 +132,14 @@ class WorkerObserver
} }
void NotifyOnIOThread() { void NotifyOnIOThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_CURRENTLY_ON(BrowserThread::IO);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::Bind(&WorkerObserver::NotifyOnUIThread, this)); base::Bind(&WorkerObserver::NotifyOnUIThread, this));
} }
void NotifyOnUIThread() { void NotifyOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (callback_.is_null()) if (callback_.is_null())
return; return;
callback_.Run(); callback_.Run();
......
...@@ -655,7 +655,7 @@ void DevToolsUIBindings::UpgradeDraggedFileSystemPermissions( ...@@ -655,7 +655,7 @@ void DevToolsUIBindings::UpgradeDraggedFileSystemPermissions(
void DevToolsUIBindings::IndexPath(int index_request_id, void DevToolsUIBindings::IndexPath(int index_request_id,
const std::string& file_system_path) { const std::string& file_system_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme)); CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme));
if (!file_helper_->IsFileSystemAdded(file_system_path)) { if (!file_helper_->IsFileSystemAdded(file_system_path)) {
IndexingDone(index_request_id, file_system_path); IndexingDone(index_request_id, file_system_path);
...@@ -682,7 +682,7 @@ void DevToolsUIBindings::IndexPath(int index_request_id, ...@@ -682,7 +682,7 @@ void DevToolsUIBindings::IndexPath(int index_request_id,
} }
void DevToolsUIBindings::StopIndexing(int index_request_id) { void DevToolsUIBindings::StopIndexing(int index_request_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
IndexingJobsMap::iterator it = indexing_jobs_.find(index_request_id); IndexingJobsMap::iterator it = indexing_jobs_.find(index_request_id);
if (it == indexing_jobs_.end()) if (it == indexing_jobs_.end())
return; return;
...@@ -693,7 +693,7 @@ void DevToolsUIBindings::StopIndexing(int index_request_id) { ...@@ -693,7 +693,7 @@ void DevToolsUIBindings::StopIndexing(int index_request_id) {
void DevToolsUIBindings::SearchInPath(int search_request_id, void DevToolsUIBindings::SearchInPath(int search_request_id,
const std::string& file_system_path, const std::string& file_system_path,
const std::string& query) { const std::string& query) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme)); CHECK(web_contents_->GetURL().SchemeIs(content::kChromeDevToolsScheme));
if (!file_helper_->IsFileSystemAdded(file_system_path)) { if (!file_helper_->IsFileSystemAdded(file_system_path)) {
SearchCompleted(search_request_id, SearchCompleted(search_request_id,
...@@ -880,7 +880,7 @@ void DevToolsUIBindings::IndexingTotalWorkCalculated( ...@@ -880,7 +880,7 @@ void DevToolsUIBindings::IndexingTotalWorkCalculated(
int request_id, int request_id,
const std::string& file_system_path, const std::string& file_system_path,
int total_work) { int total_work) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::FundamentalValue request_id_value(request_id); base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
base::FundamentalValue total_work_value(total_work); base::FundamentalValue total_work_value(total_work);
...@@ -892,7 +892,7 @@ void DevToolsUIBindings::IndexingTotalWorkCalculated( ...@@ -892,7 +892,7 @@ void DevToolsUIBindings::IndexingTotalWorkCalculated(
void DevToolsUIBindings::IndexingWorked(int request_id, void DevToolsUIBindings::IndexingWorked(int request_id,
const std::string& file_system_path, const std::string& file_system_path,
int worked) { int worked) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::FundamentalValue request_id_value(request_id); base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
base::FundamentalValue worked_value(worked); base::FundamentalValue worked_value(worked);
...@@ -903,7 +903,7 @@ void DevToolsUIBindings::IndexingWorked(int request_id, ...@@ -903,7 +903,7 @@ void DevToolsUIBindings::IndexingWorked(int request_id,
void DevToolsUIBindings::IndexingDone(int request_id, void DevToolsUIBindings::IndexingDone(int request_id,
const std::string& file_system_path) { const std::string& file_system_path) {
indexing_jobs_.erase(request_id); indexing_jobs_.erase(request_id);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::FundamentalValue request_id_value(request_id); base::FundamentalValue request_id_value(request_id);
base::StringValue file_system_path_value(file_system_path); base::StringValue file_system_path_value(file_system_path);
CallClientFunction("DevToolsAPI.indexingDone", &request_id_value, CallClientFunction("DevToolsAPI.indexingDone", &request_id_value,
...@@ -914,7 +914,7 @@ void DevToolsUIBindings::SearchCompleted( ...@@ -914,7 +914,7 @@ void DevToolsUIBindings::SearchCompleted(
int request_id, int request_id,
const std::string& file_system_path, const std::string& file_system_path,
const std::vector<std::string>& file_paths) { const std::vector<std::string>& file_paths) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::ListValue file_paths_value; base::ListValue file_paths_value;
for (std::vector<std::string>::const_iterator it(file_paths.begin()); for (std::vector<std::string>::const_iterator it(file_paths.begin());
it != file_paths.end(); ++it) { it != file_paths.end(); ++it) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment