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

Side by Side Diff: chrome/browser/automation/automation_provider.cc

Issue 6551019: Trace_event upgrades (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More gooder js thanks to arv. Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #endif // defined(OS_WIN) 106 #endif // defined(OS_WIN)
107 107
108 using base::Time; 108 using base::Time;
109 109
110 AutomationProvider::AutomationProvider(Profile* profile) 110 AutomationProvider::AutomationProvider(Profile* profile)
111 : profile_(profile), 111 : profile_(profile),
112 reply_message_(NULL), 112 reply_message_(NULL),
113 reinitialize_on_channel_error_(false), 113 reinitialize_on_channel_error_(false),
114 is_connected_(false), 114 is_connected_(false),
115 initial_loads_complete_(false) { 115 initial_loads_complete_(false) {
116 TRACE_EVENT_BEGIN("AutomationProvider::AutomationProvider", 0, ""); 116 TRACE_EVENT_BEGIN_LEGACY("AutomationProvider::AutomationProvider", 0, "");
117 117
118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
119 119
120 browser_tracker_.reset(new AutomationBrowserTracker(this)); 120 browser_tracker_.reset(new AutomationBrowserTracker(this));
121 extension_tracker_.reset(new AutomationExtensionTracker(this)); 121 extension_tracker_.reset(new AutomationExtensionTracker(this));
122 tab_tracker_.reset(new AutomationTabTracker(this)); 122 tab_tracker_.reset(new AutomationTabTracker(this));
123 window_tracker_.reset(new AutomationWindowTracker(this)); 123 window_tracker_.reset(new AutomationWindowTracker(this));
124 autocomplete_edit_tracker_.reset( 124 autocomplete_edit_tracker_.reset(
125 new AutomationAutocompleteEditTracker(this)); 125 new AutomationAutocompleteEditTracker(this));
126 new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this)); 126 new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this));
127 dom_operation_observer_.reset(new DomOperationMessageSender(this)); 127 dom_operation_observer_.reset(new DomOperationMessageSender(this));
128 metric_event_duration_observer_.reset(new MetricEventDurationObserver()); 128 metric_event_duration_observer_.reset(new MetricEventDurationObserver());
129 extension_test_result_observer_.reset( 129 extension_test_result_observer_.reset(
130 new ExtensionTestResultNotificationObserver(this)); 130 new ExtensionTestResultNotificationObserver(this));
131 g_browser_process->AddRefModule(); 131 g_browser_process->AddRefModule();
132 132
133 TRACE_EVENT_END("AutomationProvider::AutomationProvider", 0, ""); 133 TRACE_EVENT_END_LEGACY("AutomationProvider::AutomationProvider", 0, "");
134 } 134 }
135 135
136 AutomationProvider::~AutomationProvider() { 136 AutomationProvider::~AutomationProvider() {
137 STLDeleteContainerPairSecondPointers(port_containers_.begin(), 137 STLDeleteContainerPairSecondPointers(port_containers_.begin(),
138 port_containers_.end()); 138 port_containers_.end());
139 port_containers_.clear(); 139 port_containers_.clear();
140 140
141 if (channel_.get()) 141 if (channel_.get())
142 channel_->Close(); 142 channel_->Close();
143 143
144 g_browser_process->ReleaseModule(); 144 g_browser_process->ReleaseModule();
145 } 145 }
146 146
147 bool AutomationProvider::InitializeChannel(const std::string& channel_id) { 147 bool AutomationProvider::InitializeChannel(const std::string& channel_id) {
148 TRACE_EVENT_BEGIN("AutomationProvider::InitializeChannel", 0, ""); 148 TRACE_EVENT_BEGIN_LEGACY("AutomationProvider::InitializeChannel", 0, "");
149 149
150 channel_id_ = channel_id; 150 channel_id_ = channel_id;
151 std::string effective_channel_id = channel_id; 151 std::string effective_channel_id = channel_id;
152 152
153 // If the channel_id starts with kNamedInterfacePrefix, create a named IPC 153 // If the channel_id starts with kNamedInterfacePrefix, create a named IPC
154 // server and listen on it, else connect as client to an existing IPC server 154 // server and listen on it, else connect as client to an existing IPC server
155 bool use_named_interface = 155 bool use_named_interface =
156 channel_id.find(automation::kNamedInterfacePrefix) == 0; 156 channel_id.find(automation::kNamedInterfacePrefix) == 0;
157 if (use_named_interface) { 157 if (use_named_interface) {
158 effective_channel_id = channel_id.substr( 158 effective_channel_id = channel_id.substr(
(...skipping 10 matching lines...) Expand all
169 169
170 channel_.reset(new IPC::SyncChannel( 170 channel_.reset(new IPC::SyncChannel(
171 effective_channel_id, 171 effective_channel_id,
172 use_named_interface ? IPC::Channel::MODE_NAMED_SERVER 172 use_named_interface ? IPC::Channel::MODE_NAMED_SERVER
173 : IPC::Channel::MODE_CLIENT, 173 : IPC::Channel::MODE_CLIENT,
174 this, 174 this,
175 g_browser_process->io_thread()->message_loop(), 175 g_browser_process->io_thread()->message_loop(),
176 true, g_browser_process->shutdown_event())); 176 true, g_browser_process->shutdown_event()));
177 channel_->AddFilter(automation_resource_message_filter_); 177 channel_->AddFilter(automation_resource_message_filter_);
178 178
179 TRACE_EVENT_END("AutomationProvider::InitializeChannel", 0, ""); 179 TRACE_EVENT_END_LEGACY("AutomationProvider::InitializeChannel", 0, "");
180 180
181 return true; 181 return true;
182 } 182 }
183 183
184 std::string AutomationProvider::GetProtocolVersion() { 184 std::string AutomationProvider::GetProtocolVersion() {
185 chrome::VersionInfo version_info; 185 chrome::VersionInfo version_info;
186 return version_info.Version().c_str(); 186 return version_info.Version().c_str();
187 } 187 }
188 188
189 void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) { 189 void AutomationProvider::SetExpectedTabCount(size_t expected_tabs) {
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1010 }
1011 } 1011 }
1012 } 1012 }
1013 1013
1014 void AutomationProvider::SaveAsAsync(int tab_handle) { 1014 void AutomationProvider::SaveAsAsync(int tab_handle) {
1015 NavigationController* tab = NULL; 1015 NavigationController* tab = NULL;
1016 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab); 1016 TabContents* tab_contents = GetTabContentsForHandle(tab_handle, &tab);
1017 if (tab_contents) 1017 if (tab_contents)
1018 tab_contents->OnSavePage(); 1018 tab_contents->OnSavePage();
1019 } 1019 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698