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/08/02 23:31:24
My NAK on this still holds.
kkania
2011/08/03 17:38:00
Fixing this problem will require some significant
Paweł Hajdan Jr.
2011/08/03 19:09:16
Then please do those changes. What is so hard abou
| |
| 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 | |
| 426 // Make sure any old channels are cleaned up before starting up a new one. | 425 // Make sure any old channels are cleaned up before starting up a new one. |
| 427 channel_.reset(); | 426 channel_.reset(); |
| 428 return InitializeChannel(channel_id_); | 427 return InitializeChannel(channel_id_); |
| 429 } | 428 } |
| 430 | 429 |
| 431 void AutomationProvider::OnChannelError() { | 430 void AutomationProvider::OnChannelError() { |
| 432 if (reinitialize_on_channel_error_) { | 431 if (reinitialize_on_channel_error_) { |
| 433 VLOG(1) << "AutomationProxy disconnected, resetting AutomationProvider."; | 432 VLOG(1) << "AutomationProxy disconnected, resetting AutomationProvider."; |
| 434 if (ReinitializeChannel()) | 433 if (ReinitializeChannel()) |
| 435 return; | 434 return; |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 } | 959 } |
| 961 } | 960 } |
| 962 } | 961 } |
| 963 | 962 |
| 964 void AutomationProvider::SaveAsAsync(int tab_handle) { | 963 void AutomationProvider::SaveAsAsync(int tab_handle) { |
| 965 NavigationController* tab = NULL; | 964 NavigationController* tab = NULL; |
| 966 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); | 965 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); |
| 967 if (tab_contents) | 966 if (tab_contents) |
| 968 tab_contents->OnSavePage(); | 967 tab_contents->OnSavePage(); |
| 969 } | 968 } |
| OLD | NEW |