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

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

Issue 10826141: Formalise a CHECK for the NULL NavigationEntry in ScriptBadgeController, and (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add URL parameter Created 8 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/user_script_slave.h" 5 #include "chrome/renderer/extensions/user_script_slave.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 isolated_world_id, &sources.front(), sources.size(), 332 isolated_world_id, &sources.front(), sources.size(),
333 EXTENSION_GROUP_CONTENT_SCRIPTS); 333 EXTENSION_GROUP_CONTENT_SCRIPTS);
334 UMA_HISTOGRAM_TIMES("Extensions.InjectScriptTime", exec_timer.Elapsed()); 334 UMA_HISTOGRAM_TIMES("Extensions.InjectScriptTime", exec_timer.Elapsed());
335 335
336 extensions_executing_scripts.insert(extension->id()); 336 extensions_executing_scripts.insert(extension->id());
337 } 337 }
338 } 338 }
339 339
340 // Notify the browser if any extensions are now executing scripts. 340 // Notify the browser if any extensions are now executing scripts.
341 if (!extensions_executing_scripts.empty()) { 341 if (!extensions_executing_scripts.empty()) {
342 WebKit::WebFrame* target_frame = frame; 342 WebKit::WebFrame* top_frame = frame->top();
343 while (target_frame->parent())
344 target_frame = target_frame->parent();
345
346 content::RenderView* render_view = 343 content::RenderView* render_view =
347 content::RenderView::FromWebView(target_frame->view()); 344 content::RenderView::FromWebView(top_frame->view());
348 render_view->Send(new ExtensionHostMsg_ContentScriptsExecuting( 345 render_view->Send(new ExtensionHostMsg_ContentScriptsExecuting(
349 render_view->GetRoutingID(), 346 render_view->GetRoutingID(),
350 extensions_executing_scripts, 347 extensions_executing_scripts,
351 render_view->GetPageId())); 348 render_view->GetPageId(),
349 GetDataSourceURLForFrame(top_frame)));
352 } 350 }
353 351
354 // Log debug info. 352 // Log debug info.
355 if (location == UserScript::DOCUMENT_START) { 353 if (location == UserScript::DOCUMENT_START) {
356 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_CssCount", num_css); 354 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_CssCount", num_css);
357 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_ScriptCount", num_scripts); 355 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_ScriptCount", num_scripts);
358 if (num_css || num_scripts) 356 if (num_css || num_scripts)
359 UMA_HISTOGRAM_TIMES("Extensions.InjectStart_Time", timer.Elapsed()); 357 UMA_HISTOGRAM_TIMES("Extensions.InjectStart_Time", timer.Elapsed());
360 } else if (location == UserScript::DOCUMENT_END) { 358 } else if (location == UserScript::DOCUMENT_END) {
361 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectEnd_ScriptCount", num_scripts); 359 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectEnd_ScriptCount", num_scripts);
362 if (num_scripts) 360 if (num_scripts)
363 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); 361 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed());
364 } else if (location == UserScript::DOCUMENT_IDLE) { 362 } else if (location == UserScript::DOCUMENT_IDLE) {
365 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); 363 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts);
366 if (num_scripts) 364 if (num_scripts)
367 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); 365 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed());
368 } else { 366 } else {
369 NOTREACHED(); 367 NOTREACHED();
370 } 368 }
371 } 369 }
372 370
373 } // namespace extensions 371 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698