| OLD | NEW |
| 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 return frame()->script().executeScriptInMainWorldAndReturnValue( | 744 return frame()->script().executeScriptInMainWorldAndReturnValue( |
| 745 ScriptSourceCode(source.code, source.url, position)); | 745 ScriptSourceCode(source.code, source.url, position)); |
| 746 } | 746 } |
| 747 | 747 |
| 748 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( | 748 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( |
| 749 const WebScriptSource& source, | 749 const WebScriptSource& source, |
| 750 bool userGesture, | 750 bool userGesture, |
| 751 WebScriptExecutionCallback* callback) { | 751 WebScriptExecutionCallback* callback) { |
| 752 DCHECK(frame()); | 752 DCHECK(frame()); |
| 753 | 753 |
| 754 SuspendableScriptExecutor::createAndRun( | 754 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( |
| 755 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); | 755 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); |
| 756 executor->run(); |
| 756 } | 757 } |
| 757 | 758 |
| 758 void WebLocalFrameImpl::requestExecuteV8Function( | 759 void WebLocalFrameImpl::requestExecuteV8Function( |
| 759 v8::Local<v8::Context> context, | 760 v8::Local<v8::Context> context, |
| 760 v8::Local<v8::Function> function, | 761 v8::Local<v8::Function> function, |
| 761 v8::Local<v8::Value> receiver, | 762 v8::Local<v8::Value> receiver, |
| 762 int argc, | 763 int argc, |
| 763 v8::Local<v8::Value> argv[], | 764 v8::Local<v8::Value> argv[], |
| 764 WebScriptExecutionCallback* callback) { | 765 WebScriptExecutionCallback* callback) { |
| 765 DCHECK(frame()); | 766 DCHECK(frame()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 793 v8::HandleScope handleScope(toIsolate(frame())); | 794 v8::HandleScope handleScope(toIsolate(frame())); |
| 794 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); | 795 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); |
| 795 } | 796 } |
| 796 } | 797 } |
| 797 | 798 |
| 798 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( | 799 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( |
| 799 int worldID, | 800 int worldID, |
| 800 const WebScriptSource* sourcesIn, | 801 const WebScriptSource* sourcesIn, |
| 801 unsigned numSources, | 802 unsigned numSources, |
| 802 bool userGesture, | 803 bool userGesture, |
| 804 ScriptExecutionType option, |
| 803 WebScriptExecutionCallback* callback) { | 805 WebScriptExecutionCallback* callback) { |
| 804 DCHECK(frame()); | 806 DCHECK(frame()); |
| 805 CHECK_GT(worldID, 0); | 807 CHECK_GT(worldID, 0); |
| 806 CHECK_LT(worldID, EmbedderWorldIdLimit); | 808 CHECK_LT(worldID, EmbedderWorldIdLimit); |
| 807 | 809 |
| 808 SuspendableScriptExecutor::createAndRun( | 810 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( |
| 809 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, | 811 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, |
| 810 callback); | 812 callback); |
| 813 switch (option) { |
| 814 case AsyncBlockingOnload: |
| 815 executor->runAsync(true); |
| 816 break; |
| 817 case Asynchronous: |
| 818 executor->runAsync(false); |
| 819 break; |
| 820 case Synchronous: |
| 821 executor->run(); |
| 822 break; |
| 823 } |
| 811 } | 824 } |
| 812 | 825 |
| 813 // TODO(bashi): Consider returning MaybeLocal. | 826 // TODO(bashi): Consider returning MaybeLocal. |
| 814 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( | 827 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( |
| 815 v8::Local<v8::Function> function, | 828 v8::Local<v8::Function> function, |
| 816 v8::Local<v8::Value> receiver, | 829 v8::Local<v8::Value> receiver, |
| 817 int argc, | 830 int argc, |
| 818 v8::Local<v8::Value> argv[]) { | 831 v8::Local<v8::Value> argv[]) { |
| 819 DCHECK(frame()); | 832 DCHECK(frame()); |
| 820 v8::Local<v8::Value> result; | 833 v8::Local<v8::Value> result; |
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2438 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2451 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
| 2439 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2452 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2440 } else { | 2453 } else { |
| 2441 clipHtml = | 2454 clipHtml = |
| 2442 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2455 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
| 2443 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2456 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2444 } | 2457 } |
| 2445 } | 2458 } |
| 2446 | 2459 |
| 2447 } // namespace blink | 2460 } // namespace blink |
| OLD | NEW |