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

Side by Side Diff: chrome/renderer/user_script_slave.cc

Issue 448006: Revert 33255 - Report active extensions in crash reports. This only implement... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years 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
« no previous file with comments | « chrome/renderer/extensions/extension_process_bindings.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/renderer/user_script_slave.h" 5 #include "chrome/renderer/user_script_slave.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/command_line.h"
9 #include "base/histogram.h" 8 #include "base/histogram.h"
10 #include "base/logging.h" 9 #include "base/logging.h"
11 #include "base/perftimer.h" 10 #include "base/perftimer.h"
12 #include "base/pickle.h" 11 #include "base/pickle.h"
13 #include "base/shared_memory.h" 12 #include "base/shared_memory.h"
14 #include "base/string_util.h" 13 #include "base/string_util.h"
15 #include "chrome/common/child_process_logging.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
18 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
19 #include "chrome/renderer/extension_groups.h" 16 #include "chrome/renderer/extension_groups.h"
20 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
22 19
23 #include "grit/renderer_resources.h" 20 #include "grit/renderer_resources.h"
24 21
25 using WebKit::WebFrame; 22 using WebKit::WebFrame;
26 using WebKit::WebString; 23 using WebKit::WebString;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 104 }
108 for (size_t j = 0; j < script->css_scripts().size(); ++j) { 105 for (size_t j = 0; j < script->css_scripts().size(); ++j) {
109 const char* body = NULL; 106 const char* body = NULL;
110 int body_length = 0; 107 int body_length = 0;
111 CHECK(pickle.ReadData(&iter, &body, &body_length)); 108 CHECK(pickle.ReadData(&iter, &body, &body_length));
112 script->css_scripts()[j].set_external_content( 109 script->css_scripts()[j].set_external_content(
113 base::StringPiece(body, body_length)); 110 base::StringPiece(body, body_length));
114 } 111 }
115 } 112 }
116 113
117 // Update the crash reporter with all loaded extensions. In single process,
118 // this has already been done in the browser code.
119 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) {
120 std::vector<std::string> extension_ids;
121 for (size_t i = 0; i < num_scripts; ++i) {
122 DCHECK(!scripts_[i]->extension_id().empty());
123
124 // We must check this because there can be multiple scripts from a single
125 // extension. n^2, but meh, it's a small list.
126 if (std::find(extension_ids.begin(), extension_ids.end(),
127 scripts_[i]->extension_id()) == extension_ids.end()) {
128 extension_ids.push_back(scripts_[i]->extension_id());
129 }
130 }
131
132 child_process_logging::SetActiveExtensions(extension_ids);
133 }
134
135 return true; 114 return true;
136 } 115 }
137 116
138 // static 117 // static
139 void UserScriptSlave::InsertInitExtensionCode( 118 void UserScriptSlave::InsertInitExtensionCode(
140 std::vector<WebScriptSource>* sources, const std::string& extension_id) { 119 std::vector<WebScriptSource>* sources, const std::string& extension_id) {
141 DCHECK(sources); 120 DCHECK(sources);
142 sources->insert(sources->begin(), 121 sources->insert(sources->begin(),
143 WebScriptSource(WebString::fromUTF8( 122 WebScriptSource(WebString::fromUTF8(
144 StringPrintf(kInitExtension, extension_id.c_str())))); 123 StringPrintf(kInitExtension, extension_id.c_str()))));
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (num_scripts) 217 if (num_scripts)
239 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); 218 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed());
240 } else { 219 } else {
241 NOTREACHED(); 220 NOTREACHED();
242 } 221 }
243 222
244 LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css << 223 LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css <<
245 "css files into " << frame->url().spec().data(); 224 "css files into " << frame->url().spec().data();
246 return true; 225 return true;
247 } 226 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_process_bindings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698