Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 if (effective_channel_id.length() <= 0) | 149 if (effective_channel_id.length() <= 0) |
| 150 return false; | 150 return false; |
| 151 | 151 |
| 152 reinitialize_on_channel_error_ = true; | 152 reinitialize_on_channel_error_ = true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (!automation_resource_message_filter_.get()) { | 155 if (!automation_resource_message_filter_.get()) { |
| 156 automation_resource_message_filter_ = new AutomationResourceMessageFilter; | 156 automation_resource_message_filter_ = new AutomationResourceMessageFilter; |
| 157 } | 157 } |
| 158 | 158 |
| 159 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
|
Paweł Hajdan Jr.
2011/07/29 20:48:38
Let's do it on the right thread. Who knows what ra
kkania
2011/07/29 22:44:19
I believe it is on the right thread.
This is only
Paweł Hajdan Jr.
2011/07/30 00:03:03
Then you shouldn't need ScopedAllowIO here.
| |
| 159 channel_.reset(new IPC::ChannelProxy( | 160 channel_.reset(new IPC::ChannelProxy( |
| 160 effective_channel_id, | 161 effective_channel_id, |
| 161 GetChannelMode(use_named_interface), | 162 GetChannelMode(use_named_interface), |
| 162 this, | 163 this, |
| 163 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 164 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
| 164 channel_->AddFilter(automation_resource_message_filter_); | 165 channel_->AddFilter(automation_resource_message_filter_); |
| 165 | 166 |
| 166 #if defined(OS_CHROMEOS) | 167 #if defined(OS_CHROMEOS) |
| 167 // Wait for the network manager to initialize. | 168 // Wait for the network manager to initialize. |
| 168 // The observer will delete itself when done. | 169 // The observer will delete itself when done. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 DISALLOW_COPY_AND_ASSIGN(InvokeTaskLaterTask); | 415 DISALLOW_COPY_AND_ASSIGN(InvokeTaskLaterTask); |
| 415 }; | 416 }; |
| 416 | 417 |
| 417 void AutomationProvider::HandleUnused(const IPC::Message& message, int handle) { | 418 void AutomationProvider::HandleUnused(const IPC::Message& message, int handle) { |
| 418 if (window_tracker_->ContainsHandle(handle)) { | 419 if (window_tracker_->ContainsHandle(handle)) { |
| 419 window_tracker_->Remove(window_tracker_->GetResource(handle)); | 420 window_tracker_->Remove(window_tracker_->GetResource(handle)); |
| 420 } | 421 } |
| 421 } | 422 } |
| 422 | 423 |
| 423 bool AutomationProvider::ReinitializeChannel() { | 424 bool AutomationProvider::ReinitializeChannel() { |
| 424 base::ThreadRestrictions::ScopedAllowIO allow_io; | 425 base::ThreadRestrictions::ScopedAllowIO allow_io; |
|
dtu
2011/07/29 21:57:31
Remove this line since it's going in InitializeCha
kkania
2011/07/29 22:44:19
Good catch. I'll move if Pawel is ok with having i
| |
| 425 | 426 |
| 426 // Make sure any old channels are cleaned up before starting up a new one. | 427 // Make sure any old channels are cleaned up before starting up a new one. |
| 427 channel_.reset(); | 428 channel_.reset(); |
| 428 return InitializeChannel(channel_id_); | 429 return InitializeChannel(channel_id_); |
| 429 } | 430 } |
| 430 | 431 |
| 431 void AutomationProvider::OnChannelError() { | 432 void AutomationProvider::OnChannelError() { |
| 432 if (reinitialize_on_channel_error_) { | 433 if (reinitialize_on_channel_error_) { |
| 433 VLOG(1) << "AutomationProxy disconnected, resetting AutomationProvider."; | 434 VLOG(1) << "AutomationProxy disconnected, resetting AutomationProvider."; |
| 434 if (ReinitializeChannel()) | 435 if (ReinitializeChannel()) |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 } | 961 } |
| 961 } | 962 } |
| 962 } | 963 } |
| 963 | 964 |
| 964 void AutomationProvider::SaveAsAsync(int tab_handle) { | 965 void AutomationProvider::SaveAsAsync(int tab_handle) { |
| 965 NavigationController* tab = NULL; | 966 NavigationController* tab = NULL; |
| 966 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 967 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
| 967 if (tab_contents) | 968 if (tab_contents) |
| 968 tab_contents->OnSavePage(); | 969 tab_contents->OnSavePage(); |
| 969 } | 970 } |
| OLD | NEW |