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

Side by Side Diff: Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 368283002: Stream scripts to V8 as they load - Blink side. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: cleanup Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/PrivateScriptRunner.h" 6 #include "bindings/core/v8/PrivateScriptRunner.h"
7 7
8 #include "bindings/core/v8/DOMWrapperWorld.h" 8 #include "bindings/core/v8/DOMWrapperWorld.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 26 matching lines...) Expand all
37 int lineNumber = message->GetLineNumber(); 37 int lineNumber = message->GetLineNumber();
38 v8::Handle<v8::String> errorMessage = message->Get(); 38 v8::Handle<v8::String> errorMessage = message->Get();
39 fprintf(stderr, "%s (line %d): %s\n", fileName.utf8().data(), lineNumber, to CoreString(errorMessage).utf8().data()); 39 fprintf(stderr, "%s (line %d): %s\n", fileName.utf8().data(), lineNumber, to CoreString(errorMessage).utf8().data());
40 } 40 }
41 41
42 static v8::Handle<v8::Value> compileAndRunPrivateScript(v8::Isolate* isolate, St ring scriptClassName, const unsigned char* source, size_t size) 42 static v8::Handle<v8::Value> compileAndRunPrivateScript(v8::Isolate* isolate, St ring scriptClassName, const unsigned char* source, size_t size)
43 { 43 {
44 v8::TryCatch block; 44 v8::TryCatch block;
45 String sourceString(reinterpret_cast<const char*>(source), size); 45 String sourceString(reinterpret_cast<const char*>(source), size);
46 String fileName = scriptClassName + ".js"; 46 String fileName = scriptClassName + ".js";
47 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isola te, sourceString), fileName, TextPosition::minimumPosition(), 0, isolate, NotSha rableCrossOrigin, V8CacheOptionsOff); 47 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isola te, sourceString), fileName, TextPosition::minimumPosition(), 0, 0, isolate, Not SharableCrossOrigin, V8CacheOptionsOff);
48 if (block.HasCaught()) { 48 if (block.HasCaught()) {
49 fprintf(stderr, "Private script error: Compile failed. (Class name = %s) \n", scriptClassName.utf8().data()); 49 fprintf(stderr, "Private script error: Compile failed. (Class name = %s) \n", scriptClassName.utf8().data());
50 dumpV8Message(block.Message()); 50 dumpV8Message(block.Message());
51 RELEASE_ASSERT_NOT_REACHED(); 51 RELEASE_ASSERT_NOT_REACHED();
52 } 52 }
53 53
54 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledInternalScript(scr ipt, isolate); 54 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledInternalScript(scr ipt, isolate);
55 if (block.HasCaught()) { 55 if (block.HasCaught()) {
56 fprintf(stderr, "Private script error: installClass() failed. (Class nam e = %s)\n", scriptClassName.utf8().data()); 56 fprintf(stderr, "Private script error: installClass() failed. (Class nam e = %s)\n", scriptClassName.utf8().data());
57 dumpV8Message(block.Message()); 57 dumpV8Message(block.Message());
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 exceptionState.throwIfNeeded(); 263 exceptionState.throwIfNeeded();
264 return; 264 return;
265 } 265 }
266 266
267 fprintf(stderr, "Private script error: %s was thrown.\n", exceptionName.utf8 ().data()); 267 fprintf(stderr, "Private script error: %s was thrown.\n", exceptionName.utf8 ().data());
268 dumpV8Message(tryCatchMessage); 268 dumpV8Message(tryCatchMessage);
269 RELEASE_ASSERT_NOT_REACHED(); 269 RELEASE_ASSERT_NOT_REACHED();
270 } 270 }
271 271
272 } // namespace blink 272 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptDebugServer.cpp » ('j') | Source/bindings/core/v8/ScriptStreamer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698