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

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2633253002: Split content script injections into multiple tasks (Closed)
Patch Set: Inject document_idle scripts before window.onload Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return frame()->script().executeScriptInMainWorldAndReturnValue( 742 return frame()->script().executeScriptInMainWorldAndReturnValue(
743 ScriptSourceCode(source.code, source.url, position)); 743 ScriptSourceCode(source.code, source.url, position));
744 } 744 }
745 745
746 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( 746 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue(
747 const WebScriptSource& source, 747 const WebScriptSource& source,
748 bool userGesture, 748 bool userGesture,
749 WebScriptExecutionCallback* callback) { 749 WebScriptExecutionCallback* callback) {
750 DCHECK(frame()); 750 DCHECK(frame());
751 751
752 SuspendableScriptExecutor::createAndRun( 752 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create(
753 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); 753 frame(), 0, createSourcesVector(&source, 1), userGesture, callback);
754 executor->run();
754 } 755 }
755 756
756 void WebLocalFrameImpl::requestExecuteV8Function( 757 void WebLocalFrameImpl::requestExecuteV8Function(
757 v8::Local<v8::Context> context, 758 v8::Local<v8::Context> context,
758 v8::Local<v8::Function> function, 759 v8::Local<v8::Function> function,
759 v8::Local<v8::Value> receiver, 760 v8::Local<v8::Value> receiver,
760 int argc, 761 int argc,
761 v8::Local<v8::Value> argv[], 762 v8::Local<v8::Value> argv[],
762 WebScriptExecutionCallback* callback) { 763 WebScriptExecutionCallback* callback) {
763 DCHECK(frame()); 764 DCHECK(frame());
(...skipping 27 matching lines...) Expand all
791 v8::HandleScope handleScope(toIsolate(frame())); 792 v8::HandleScope handleScope(toIsolate(frame()));
792 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); 793 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0);
793 } 794 }
794 } 795 }
795 796
796 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( 797 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(
797 int worldID, 798 int worldID,
798 const WebScriptSource* sourcesIn, 799 const WebScriptSource* sourcesIn,
799 unsigned numSources, 800 unsigned numSources,
800 bool userGesture, 801 bool userGesture,
802 ScriptExecutionType option,
801 WebScriptExecutionCallback* callback) { 803 WebScriptExecutionCallback* callback) {
802 DCHECK(frame()); 804 DCHECK(frame());
803 CHECK_GT(worldID, 0); 805 CHECK_GT(worldID, 0);
804 CHECK_LT(worldID, EmbedderWorldIdLimit); 806 CHECK_LT(worldID, EmbedderWorldIdLimit);
805 807
806 SuspendableScriptExecutor::createAndRun( 808 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create(
807 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, 809 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture,
808 callback); 810 callback);
811 switch (option) {
812 case AsyncBlockingOnload:
813 executor->runAsync(true);
814 break;
815 case Asynchronous:
816 executor->runAsync(false);
817 break;
818 case Synchronous:
819 executor->run();
820 break;
821 }
809 } 822 }
810 823
811 // TODO(bashi): Consider returning MaybeLocal. 824 // TODO(bashi): Consider returning MaybeLocal.
812 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( 825 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(
813 v8::Local<v8::Function> function, 826 v8::Local<v8::Function> function,
814 v8::Local<v8::Value> receiver, 827 v8::Local<v8::Value> receiver,
815 int argc, 828 int argc,
816 v8::Local<v8::Value> argv[]) { 829 v8::Local<v8::Value> argv[]) {
817 DCHECK(frame()); 830 DCHECK(frame());
818 v8::Local<v8::Value> result; 831 v8::Local<v8::Value> result;
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2424 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2412 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2425 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2413 } else { 2426 } else {
2414 clipHtml = 2427 clipHtml =
2415 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2428 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2416 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2429 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2417 } 2430 }
2418 } 2431 }
2419 2432
2420 } // namespace blink 2433 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698