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

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

Issue 2735973006: Bindings: Separate WorldIdConstants into WorldTypes and WorldId (Closed)
Patch Set: rebase 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
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 frame()->script().executeScriptInMainWorld( 664 frame()->script().executeScriptInMainWorld(
665 ScriptSourceCode(source.code, source.url, position)); 665 ScriptSourceCode(source.code, source.url, position));
666 } 666 }
667 667
668 void WebLocalFrameImpl::executeScriptInIsolatedWorld( 668 void WebLocalFrameImpl::executeScriptInIsolatedWorld(
669 int worldID, 669 int worldID,
670 const WebScriptSource* sourcesIn, 670 const WebScriptSource* sourcesIn,
671 unsigned numSources) { 671 unsigned numSources) {
672 DCHECK(frame()); 672 DCHECK(frame());
673 CHECK_GT(worldID, 0); 673 CHECK_GT(worldID, 0);
674 CHECK_LT(worldID, EmbedderWorldIdLimit); 674 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit);
675 675
676 HeapVector<ScriptSourceCode> sources = 676 HeapVector<ScriptSourceCode> sources =
677 createSourcesVector(sourcesIn, numSources); 677 createSourcesVector(sourcesIn, numSources);
678 v8::HandleScope handleScope(toIsolate(frame())); 678 v8::HandleScope handleScope(toIsolate(frame()));
679 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); 679 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0);
680 } 680 }
681 681
682 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin( 682 void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin(
683 int worldID, 683 int worldID,
684 const WebSecurityOrigin& securityOrigin) { 684 const WebSecurityOrigin& securityOrigin) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 callback); 768 callback);
769 } 769 }
770 770
771 void WebLocalFrameImpl::executeScriptInIsolatedWorld( 771 void WebLocalFrameImpl::executeScriptInIsolatedWorld(
772 int worldID, 772 int worldID,
773 const WebScriptSource* sourcesIn, 773 const WebScriptSource* sourcesIn,
774 unsigned numSources, 774 unsigned numSources,
775 WebVector<v8::Local<v8::Value>>* results) { 775 WebVector<v8::Local<v8::Value>>* results) {
776 DCHECK(frame()); 776 DCHECK(frame());
777 CHECK_GT(worldID, 0); 777 CHECK_GT(worldID, 0);
778 CHECK_LT(worldID, EmbedderWorldIdLimit); 778 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit);
779 779
780 HeapVector<ScriptSourceCode> sources = 780 HeapVector<ScriptSourceCode> sources =
781 createSourcesVector(sourcesIn, numSources); 781 createSourcesVector(sourcesIn, numSources);
782 782
783 if (results) { 783 if (results) {
784 Vector<v8::Local<v8::Value>> scriptResults; 784 Vector<v8::Local<v8::Value>> scriptResults;
785 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 785 frame()->script().executeScriptInIsolatedWorld(worldID, sources,
786 &scriptResults); 786 &scriptResults);
787 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size()); 787 WebVector<v8::Local<v8::Value>> v8Results(scriptResults.size());
788 for (unsigned i = 0; i < scriptResults.size(); i++) 788 for (unsigned i = 0; i < scriptResults.size(); i++)
789 v8Results[i] = 789 v8Results[i] =
790 v8::Local<v8::Value>::New(toIsolate(frame()), scriptResults[i]); 790 v8::Local<v8::Value>::New(toIsolate(frame()), scriptResults[i]);
791 results->swap(v8Results); 791 results->swap(v8Results);
792 } else { 792 } else {
793 v8::HandleScope handleScope(toIsolate(frame())); 793 v8::HandleScope handleScope(toIsolate(frame()));
794 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); 794 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0);
795 } 795 }
796 } 796 }
797 797
798 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( 798 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(
799 int worldID, 799 int worldID,
800 const WebScriptSource* sourcesIn, 800 const WebScriptSource* sourcesIn,
801 unsigned numSources, 801 unsigned numSources,
802 bool userGesture, 802 bool userGesture,
803 WebScriptExecutionCallback* callback) { 803 WebScriptExecutionCallback* callback) {
804 DCHECK(frame()); 804 DCHECK(frame());
805 CHECK_GT(worldID, 0); 805 CHECK_GT(worldID, 0);
806 CHECK_LT(worldID, EmbedderWorldIdLimit); 806 CHECK_LT(worldID, DOMWrapperWorld::EmbedderWorldIdLimit);
807 807
808 SuspendableScriptExecutor::createAndRun( 808 SuspendableScriptExecutor::createAndRun(
809 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, 809 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture,
810 callback); 810 callback);
811 } 811 }
812 812
813 // TODO(bashi): Consider returning MaybeLocal. 813 // TODO(bashi): Consider returning MaybeLocal.
814 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( 814 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(
815 v8::Local<v8::Function> function, 815 v8::Local<v8::Function> function,
816 v8::Local<v8::Value> receiver, 816 v8::Local<v8::Value> receiver,
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2460 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2461 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2461 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2462 } else { 2462 } else {
2463 clipHtml = 2463 clipHtml =
2464 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2464 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2465 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2465 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2466 } 2466 }
2467 } 2467 }
2468 2468
2469 } // namespace blink 2469 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698