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

Side by Side Diff: components/translate/core/browser/translate_script.cc

Issue 686963002: Switching profiler instrumentations from ScopedProfile to ScopedTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/translate/core/browser/translate_script.h" 5 #include "components/translate/core/browser/translate_script.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/profiler/scoped_profile.h" 11 #include "base/profiler/scoped_tracker.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "components/translate/core/browser/translate_url_fetcher.h" 15 #include "components/translate/core/browser/translate_url_fetcher.h"
16 #include "components/translate/core/browser/translate_url_util.h" 16 #include "components/translate/core/browser/translate_url_util.h"
17 #include "components/translate/core/common/translate_switches.h" 17 #include "components/translate/core/common/translate_switches.h"
18 #include "components/translate/core/common/translate_util.h" 18 #include "components/translate/core/common/translate_util.h"
19 #include "google_apis/google_api_keys.h" 19 #include "google_apis/google_api_keys.h"
20 #include "grit/components_resources.h" 20 #include "grit/components_resources.h"
21 #include "net/base/escape.h" 21 #include "net/base/escape.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 fetcher_->set_extra_request_header(kRequestHeader); 111 fetcher_->set_extra_request_header(kRequestHeader);
112 fetcher_->Request( 112 fetcher_->Request(
113 translate_script_url, 113 translate_script_url,
114 base::Bind(&TranslateScript::OnScriptFetchComplete, 114 base::Bind(&TranslateScript::OnScriptFetchComplete,
115 base::Unretained(this))); 115 base::Unretained(this)));
116 } 116 }
117 117
118 118
119 void TranslateScript::OnScriptFetchComplete( 119 void TranslateScript::OnScriptFetchComplete(
120 int id, bool success, const std::string& data) { 120 int id, bool success, const std::string& data) {
121 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. 121 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed.
122 tracked_objects::ScopedProfile tracking_profile( 122 tracked_objects::ScopedTracker tracking_profile(
123 FROM_HERE_WITH_EXPLICIT_FUNCTION( 123 FROM_HERE_WITH_EXPLICIT_FUNCTION(
124 "422577 TranslateScript::OnScriptFetchComplete")); 124 "422577 TranslateScript::OnScriptFetchComplete"));
125 125
126 DCHECK_EQ(kFetcherId, id); 126 DCHECK_EQ(kFetcherId, id);
127 127
128 scoped_ptr<const TranslateURLFetcher> delete_ptr(fetcher_.release()); 128 scoped_ptr<const TranslateURLFetcher> delete_ptr(fetcher_.release());
129 129
130 if (success) { 130 if (success) {
131 DCHECK(data_.empty()); 131 DCHECK(data_.empty());
132 // Insert variable definitions on API Key and security origin. 132 // Insert variable definitions on API Key and security origin.
(...skipping 22 matching lines...) Expand all
155 155
156 for (RequestCallbackList::iterator it = callback_list_.begin(); 156 for (RequestCallbackList::iterator it = callback_list_.begin();
157 it != callback_list_.end(); 157 it != callback_list_.end();
158 ++it) { 158 ++it) {
159 it->Run(success, data); 159 it->Run(success, data);
160 } 160 }
161 callback_list_.clear(); 161 callback_list_.clear();
162 } 162 }
163 163
164 } // namespace translate 164 } // namespace translate
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698