| OLD | NEW |
| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 GURL(iter->url).path()); | 345 GURL(iter->url).path()); |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 // Notify the browser if any extensions are now executing scripts. | 350 // Notify the browser if any extensions are now executing scripts. |
| 351 if (!extensions_executing_scripts.empty()) { | 351 if (!extensions_executing_scripts.empty()) { |
| 352 blink::WebFrame* top_frame = frame->top(); | 352 blink::WebFrame* top_frame = frame->top(); |
| 353 content::RenderView* render_view = | 353 content::RenderView* render_view = |
| 354 content::RenderView::FromWebView(top_frame->view()); | 354 content::RenderView::FromWebView(top_frame->view()); |
| 355 render_view->Send(new ExtensionHostMsg_ContentScriptsExecuting( | 355 if (render_view) { |
| 356 render_view->GetRoutingID(), | 356 render_view->Send(new ExtensionHostMsg_ContentScriptsExecuting( |
| 357 extensions_executing_scripts, | 357 render_view->GetRoutingID(), |
| 358 render_view->GetPageId(), | 358 extensions_executing_scripts, |
| 359 GetDataSourceURLForFrame(top_frame))); | 359 render_view->GetPageId(), |
| 360 GetDataSourceURLForFrame(top_frame))); |
| 361 } |
| 360 } | 362 } |
| 361 | 363 |
| 362 // Log debug info. | 364 // Log debug info. |
| 363 if (location == UserScript::DOCUMENT_START) { | 365 if (location == UserScript::DOCUMENT_START) { |
| 364 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_CssCount", num_css); | 366 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_CssCount", num_css); |
| 365 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_ScriptCount", num_scripts); | 367 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_ScriptCount", num_scripts); |
| 366 if (num_css || num_scripts) | 368 if (num_css || num_scripts) |
| 367 UMA_HISTOGRAM_TIMES("Extensions.InjectStart_Time", timer.Elapsed()); | 369 UMA_HISTOGRAM_TIMES("Extensions.InjectStart_Time", timer.Elapsed()); |
| 368 } else if (location == UserScript::DOCUMENT_END) { | 370 } else if (location == UserScript::DOCUMENT_END) { |
| 369 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectEnd_ScriptCount", num_scripts); | 371 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectEnd_ScriptCount", num_scripts); |
| 370 if (num_scripts) | 372 if (num_scripts) |
| 371 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); | 373 UMA_HISTOGRAM_TIMES("Extensions.InjectEnd_Time", timer.Elapsed()); |
| 372 } else if (location == UserScript::DOCUMENT_IDLE) { | 374 } else if (location == UserScript::DOCUMENT_IDLE) { |
| 373 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); | 375 UMA_HISTOGRAM_COUNTS_100("Extensions.InjectIdle_ScriptCount", num_scripts); |
| 374 if (num_scripts) | 376 if (num_scripts) |
| 375 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); | 377 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); |
| 376 } else { | 378 } else { |
| 377 NOTREACHED(); | 379 NOTREACHED(); |
| 378 } | 380 } |
| 379 } | 381 } |
| 380 | 382 |
| 381 } // namespace extensions | 383 } // namespace extensions |
| OLD | NEW |