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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 2724673002: [WIP] Introduce ScriptResourceData
Patch Set: Fix Created 3 years, 7 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 19 matching lines...) Expand all
30 #include "bindings/core/v8/ScriptStreamer.h" 30 #include "bindings/core/v8/ScriptStreamer.h"
31 #include "bindings/core/v8/V8BindingForCore.h" 31 #include "bindings/core/v8/V8BindingForCore.h"
32 #include "bindings/core/v8/V8GCController.h" 32 #include "bindings/core/v8/V8GCController.h"
33 #include "bindings/core/v8/V8ThrowException.h" 33 #include "bindings/core/v8/V8ThrowException.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/ExecutionContext.h" 35 #include "core/dom/ExecutionContext.h"
36 #include "core/frame/LocalDOMWindow.h" 36 #include "core/frame/LocalDOMWindow.h"
37 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
38 #include "core/inspector/InspectorTraceEvents.h" 38 #include "core/inspector/InspectorTraceEvents.h"
39 #include "core/inspector/ThreadDebugger.h" 39 #include "core/inspector/ThreadDebugger.h"
40 #include "core/loader/resource/ScriptResource.h" 40 #include "core/loader/resource/ScriptResourceData.h"
41 #include "core/probe/CoreProbes.h" 41 #include "core/probe/CoreProbes.h"
42 #include "platform/Histogram.h" 42 #include "platform/Histogram.h"
43 #include "platform/ScriptForbiddenScope.h" 43 #include "platform/ScriptForbiddenScope.h"
44 #include "platform/instrumentation/tracing/TraceEvent.h" 44 #include "platform/instrumentation/tracing/TraceEvent.h"
45 #include "platform/loader/fetch/CachedMetadata.h" 45 #include "platform/loader/fetch/CachedMetadata.h"
46 #include "platform/wtf/CurrentTime.h" 46 #include "platform/wtf/CurrentTime.h"
47 #include "public/platform/Platform.h" 47 #include "public/platform/Platform.h"
48 48
49 #if OS(WIN) 49 #if OS(WIN)
50 #include <malloc.h> 50 #include <malloc.h>
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 break; 395 break;
396 } 396 }
397 397
398 // All switch branches should return and we should never get here. 398 // All switch branches should return and we should never get here.
399 // But some compilers aren't sure, hence this default. 399 // But some compilers aren't sure, hence this default.
400 NOTREACHED(); 400 NOTREACHED();
401 return Bind(CompileWithoutOptions, V8CompileHistogram::kCacheable); 401 return Bind(CompileWithoutOptions, V8CompileHistogram::kCacheable);
402 } 402 }
403 403
404 // Select a compile function for a streaming compile. 404 // Select a compile function for a streaming compile.
405 std::unique_ptr<CompileFn> SelectCompileFunction(V8CacheOptions cache_options, 405 std::unique_ptr<CompileFn> SelectCompileFunction(
406 ScriptResource* resource, 406 V8CacheOptions cache_options,
407 ScriptStreamer* streamer) { 407 const ScriptResourceData* resource,
kinuko 2017/05/18 05:43:30 resource_data ?
408 ScriptStreamer* streamer) {
408 // We don't stream scripts which don't have a Resource. 409 // We don't stream scripts which don't have a Resource.
409 DCHECK(resource); 410 DCHECK(resource);
410 // Failed resources should never get this far. 411 // Failed resources should never get this far.
411 DCHECK(!resource->ErrorOccurred()); 412 DCHECK(!resource->ErrorOccurred());
412 DCHECK(streamer->IsFinished()); 413 DCHECK(streamer->IsFinished());
413 DCHECK(!streamer->StreamingSuppressed()); 414 DCHECK(!streamer->StreamingSuppressed());
414 return WTF::Bind(PostStreamCompile, cache_options, 415 return WTF::Bind(PostStreamCompile, cache_options,
415 WrapPersistent(resource->CacheHandler()), 416 WrapPersistent(resource->CacheHandler()),
416 WrapPersistent(streamer)); 417 WrapPersistent(streamer));
417 } 418 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 cache_metadata_handler, access_control_status, 452 cache_metadata_handler, access_control_status,
452 v8_cache_options); 453 v8_cache_options);
453 } 454 }
454 455
455 v8::MaybeLocal<v8::Script> V8ScriptRunner::CompileScript( 456 v8::MaybeLocal<v8::Script> V8ScriptRunner::CompileScript(
456 v8::Local<v8::String> code, 457 v8::Local<v8::String> code,
457 const String& file_name, 458 const String& file_name,
458 const String& source_map_url, 459 const String& source_map_url,
459 const TextPosition& script_start_position, 460 const TextPosition& script_start_position,
460 v8::Isolate* isolate, 461 v8::Isolate* isolate,
461 ScriptResource* resource, 462 const ScriptResourceData* resource,
kinuko 2017/05/18 05:43:30 ditto
462 ScriptStreamer* streamer, 463 ScriptStreamer* streamer,
463 CachedMetadataHandler* cache_handler, 464 CachedMetadataHandler* cache_handler,
464 AccessControlStatus access_control_status, 465 AccessControlStatus access_control_status,
465 V8CacheOptions cache_options) { 466 V8CacheOptions cache_options) {
466 TRACE_EVENT2( 467 TRACE_EVENT2(
467 "v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(), 468 "v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(),
468 "data", 469 "data",
469 InspectorCompileScriptEvent::Data(file_name, script_start_position)); 470 InspectorCompileScriptEvent::Data(file_name, script_start_position));
470 471
471 DCHECK(!streamer || resource); 472 DCHECK(!streamer || resource);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (!context->GetExtrasBindingObject() 764 if (!context->GetExtrasBindingObject()
764 ->Get(context, V8AtomicString(isolate, name)) 765 ->Get(context, V8AtomicString(isolate, name))
765 .ToLocal(&function_value)) 766 .ToLocal(&function_value))
766 return v8::MaybeLocal<v8::Value>(); 767 return v8::MaybeLocal<v8::Value>();
767 v8::Local<v8::Function> function = function_value.As<v8::Function>(); 768 v8::Local<v8::Function> function = function_value.As<v8::Function>();
768 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate), 769 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate),
769 num_args, args, isolate); 770 num_args, args, isolate);
770 } 771 }
771 772
772 } // namespace blink 773 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698