| OLD | NEW |
| 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 "extensions/renderer/script_injection.h" | 5 #include "extensions/renderer/script_injection.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 option = blink::WebLocalFrame::Synchronous; | 309 option = blink::WebLocalFrame::Synchronous; |
| 310 break; | 310 break; |
| 311 } | 311 } |
| 312 } else { | 312 } else { |
| 313 option = blink::WebLocalFrame::Synchronous; | 313 option = blink::WebLocalFrame::Synchronous; |
| 314 } | 314 } |
| 315 web_frame->requestExecuteScriptInIsolatedWorld( | 315 web_frame->requestExecuteScriptInIsolatedWorld( |
| 316 world_id, &sources.front(), sources.size(), is_user_gesture, option, | 316 world_id, &sources.front(), sources.size(), is_user_gesture, option, |
| 317 callback.release()); | 317 callback.release()); |
| 318 } | 318 } |
| 319 | |
| 320 if (injection_host_->id().type() == HostID::EXTENSIONS) | |
| 321 UMA_HISTOGRAM_TIMES("Extensions.InjectScriptTime", exec_timer.Elapsed()); | |
| 322 } | 319 } |
| 323 | 320 |
| 324 void ScriptInjection::OnJsInjectionCompleted( | 321 void ScriptInjection::OnJsInjectionCompleted( |
| 325 const std::vector<v8::Local<v8::Value>>& results, | 322 const std::vector<v8::Local<v8::Value>>& results, |
| 326 base::TimeDelta elapsed) { | 323 base::TimeDelta elapsed) { |
| 327 DCHECK(!did_inject_js_); | 324 DCHECK(!did_inject_js_); |
| 328 | 325 |
| 329 if (injection_host_->id().type() == HostID::EXTENSIONS) | 326 if (injection_host_->id().type() == HostID::EXTENSIONS) |
| 330 UMA_HISTOGRAM_TIMES("Extensions.InjectedScriptExecutionTime", elapsed); | 327 UMA_HISTOGRAM_TIMES("Extensions.InjectedScriptExecutionTime", elapsed); |
| 331 | 328 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 362 void ScriptInjection::InjectCss(std::set<std::string>* injected_stylesheets, | 359 void ScriptInjection::InjectCss(std::set<std::string>* injected_stylesheets, |
| 363 size_t* num_injected_stylesheets) { | 360 size_t* num_injected_stylesheets) { |
| 364 std::vector<blink::WebString> css_sources = injector_->GetCssSources( | 361 std::vector<blink::WebString> css_sources = injector_->GetCssSources( |
| 365 run_location_, injected_stylesheets, num_injected_stylesheets); | 362 run_location_, injected_stylesheets, num_injected_stylesheets); |
| 366 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); | 363 blink::WebLocalFrame* web_frame = render_frame_->GetWebFrame(); |
| 367 for (const blink::WebString& css : css_sources) | 364 for (const blink::WebString& css : css_sources) |
| 368 web_frame->document().insertStyleSheet(css); | 365 web_frame->document().insertStyleSheet(css); |
| 369 } | 366 } |
| 370 | 367 |
| 371 } // namespace extensions | 368 } // namespace extensions |
| OLD | NEW |