| 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 return frame()->script().executeScriptInMainWorldAndReturnValue( | 741 return frame()->script().executeScriptInMainWorldAndReturnValue( |
| 742 ScriptSourceCode(source.code, source.url, position)); | 742 ScriptSourceCode(source.code, source.url, position)); |
| 743 } | 743 } |
| 744 | 744 |
| 745 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( | 745 void WebLocalFrameImpl::requestExecuteScriptAndReturnValue( |
| 746 const WebScriptSource& source, | 746 const WebScriptSource& source, |
| 747 bool userGesture, | 747 bool userGesture, |
| 748 WebScriptExecutionCallback* callback) { | 748 WebScriptExecutionCallback* callback) { |
| 749 DCHECK(frame()); | 749 DCHECK(frame()); |
| 750 | 750 |
| 751 SuspendableScriptExecutor::createAndRun( | 751 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( |
| 752 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); | 752 frame(), 0, createSourcesVector(&source, 1), userGesture, callback); |
| 753 executor->run(); |
| 753 } | 754 } |
| 754 | 755 |
| 755 void WebLocalFrameImpl::requestExecuteV8Function( | 756 void WebLocalFrameImpl::requestExecuteV8Function( |
| 756 v8::Local<v8::Context> context, | 757 v8::Local<v8::Context> context, |
| 757 v8::Local<v8::Function> function, | 758 v8::Local<v8::Function> function, |
| 758 v8::Local<v8::Value> receiver, | 759 v8::Local<v8::Value> receiver, |
| 759 int argc, | 760 int argc, |
| 760 v8::Local<v8::Value> argv[], | 761 v8::Local<v8::Value> argv[], |
| 761 WebScriptExecutionCallback* callback) { | 762 WebScriptExecutionCallback* callback) { |
| 762 DCHECK(frame()); | 763 DCHECK(frame()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 790 v8::HandleScope handleScope(toIsolate(frame())); | 791 v8::HandleScope handleScope(toIsolate(frame())); |
| 791 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); | 792 frame()->script().executeScriptInIsolatedWorld(worldID, sources, 0); |
| 792 } | 793 } |
| 793 } | 794 } |
| 794 | 795 |
| 795 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( | 796 void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld( |
| 796 int worldID, | 797 int worldID, |
| 797 const WebScriptSource* sourcesIn, | 798 const WebScriptSource* sourcesIn, |
| 798 unsigned numSources, | 799 unsigned numSources, |
| 799 bool userGesture, | 800 bool userGesture, |
| 801 ScriptExecutionType option, |
| 800 WebScriptExecutionCallback* callback) { | 802 WebScriptExecutionCallback* callback) { |
| 801 DCHECK(frame()); | 803 DCHECK(frame()); |
| 802 CHECK_GT(worldID, 0); | 804 CHECK_GT(worldID, 0); |
| 803 CHECK_LT(worldID, EmbedderWorldIdLimit); | 805 CHECK_LT(worldID, EmbedderWorldIdLimit); |
| 804 | 806 |
| 805 SuspendableScriptExecutor::createAndRun( | 807 SuspendableScriptExecutor* executor = SuspendableScriptExecutor::create( |
| 806 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, | 808 frame(), worldID, createSourcesVector(sourcesIn, numSources), userGesture, |
| 807 callback); | 809 callback); |
| 810 switch (option) { |
| 811 case AsyncBlockingOnload: |
| 812 executor->runAsync(true); |
| 813 break; |
| 814 case Asynchronous: |
| 815 executor->runAsync(false); |
| 816 break; |
| 817 case Synchronous: |
| 818 executor->run(); |
| 819 break; |
| 820 } |
| 808 } | 821 } |
| 809 | 822 |
| 810 // TODO(bashi): Consider returning MaybeLocal. | 823 // TODO(bashi): Consider returning MaybeLocal. |
| 811 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( | 824 v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled( |
| 812 v8::Local<v8::Function> function, | 825 v8::Local<v8::Function> function, |
| 813 v8::Local<v8::Value> receiver, | 826 v8::Local<v8::Value> receiver, |
| 814 int argc, | 827 int argc, |
| 815 v8::Local<v8::Value> argv[]) { | 828 v8::Local<v8::Value> argv[]) { |
| 816 DCHECK(frame()); | 829 DCHECK(frame()); |
| 817 v8::Local<v8::Value> result; | 830 v8::Local<v8::Value> result; |
| (...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2423 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
| 2411 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2424 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2412 } else { | 2425 } else { |
| 2413 clipHtml = | 2426 clipHtml = |
| 2414 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2427 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
| 2415 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2428 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
| 2416 } | 2429 } |
| 2417 } | 2430 } |
| 2418 | 2431 |
| 2419 } // namespace blink | 2432 } // namespace blink |
| OLD | NEW |