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

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

Issue 2633253002: Split content script injections into multiple tasks (Closed)
Patch Set: comments addressed Created 3 years, 9 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 return frame()->script().executeScriptInMainWorldAndReturnValue( 747 return frame()->script().executeScriptInMainWorldAndReturnValue(
748 ScriptSourceCode(source.code, source.url, position)); 748 ScriptSourceCode(source.code, source.url, position));
749 } 749 }
750 750
751 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( 751 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue(
752 const WebScriptSource& source, 752 const WebScriptSource& source,
753 bool userGesture, 753 bool userGesture,
754 WebScriptExecutionCallback* callback) { 754 WebScriptExecutionCallback* callback) {
755 DCHECK(frame()); 755 DCHECK(frame());
756 756
757 SuspendableScriptExecutor::createAndRun( 757 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create(
758 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); 758 frame(), 0, createSourcesVector(&source, 1), userGesture, callback);
759 executor->run();
759 } 760 }
760 761
761 void WebLocalFrameImpl::requestExecuteV8Function( 762 void WebLocalFrameImpl::requestExecuteV8Function(
762 v8::Local<v8::Context> context, 763 v8::Local<v8::Context> context,
763 v8::Local<v8::Function> function, 764 v8::Local<v8::Function> function,
764 v8::Local<v8::Value> receiver, 765 v8::Local<v8::Value> receiver,
765 int argc, 766 int argc,
766 v8::Local<v8::Value> argv[], 767 v8::Local<v8::Value> argv[],
767 WebScriptExecutionCallback* callback) { 768 WebScriptExecutionCallback* callback) {
768 DCHECK(frame()); 769 DCHECK(frame());
(...skipping 27 matching lines...) Expand all
796 v8::HandleScope handleScope(toIsolate(frame())); 797 v8::HandleScope handleScope(toIsolate(frame()));
797 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); 798 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0);
798 } 799 }
799 } 800 }
800 801
801 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( 802 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(
802 int worldID, 803 int worldID,
803 const WebScriptSource* sourcesIn, 804 const WebScriptSource* sourcesIn,
804 unsigned numSources, 805 unsigned numSources,
805 bool userGesture, 806 bool userGesture,
807 ScriptExecutionType option,
806 WebScriptExecutionCallback* callback) { 808 WebScriptExecutionCallback* callback) {
807 DCHECK(frame()); 809 DCHECK(frame());
808 CHECK_GT(worldID, 0); 810 CHECK_GT(worldID, 0);
809 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit); 811 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit);
810 812
811 SuspendableScriptExecutor::createAndRun( 813 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create(
812 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, 814 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture,
813 callback); 815 callback);
816 switch (option) {
817 case AsynchronousBlockingOnload:
818 executor->runAsync(SuspendableScriptExecutor::OnloadBlocking);
819 break;
820 case Asynchronous:
821 executor->runAsync(SuspendableScriptExecutor::NonBlocking);
822 break;
823 case Synchronous:
824 executor->run();
825 break;
826 }
814 } 827 }
815 828
816 // TODO(bashi): Consider returning MaybeLocal. 829 // TODO(bashi): Consider returning MaybeLocal.
817 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( 830 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(
818 v8::Local<v8::Function> function, 831 v8::Local<v8::Function> function,
819 v8::Local<v8::Value> receiver, 832 v8::Local<v8::Value> receiver,
820 int argc, 833 int argc,
821 v8::Local<v8::Value> argv[]) { 834 v8::Local<v8::Value> argv[]) {
822 DCHECK(frame()); 835 DCHECK(frame());
823 v8::Local<v8::Value> result; 836 v8::Local<v8::Value> result;
(...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2476 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2464 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2477 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2465 } else { 2478 } else {
2466 clipHtml = 2479 clipHtml =
2467 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2480 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2468 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2469 } 2482 }
2470 } 2483 }
2471 2484
2472 } // namespace blink 2485 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698