| 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 | 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 Loading... |
| 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 "build/build_config.h" | 33 #include "build/build_config.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/bindings/V8ThrowException.h" | 44 #include "platform/bindings/V8ThrowException.h" |
| 45 #include "platform/instrumentation/tracing/TraceEvent.h" | 45 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 46 #include "platform/loader/fetch/CachedMetadata.h" | 46 #include "platform/loader/fetch/CachedMetadata.h" |
| 47 #include "platform/wtf/Assertions.h" | 47 #include "platform/wtf/Assertions.h" |
| 48 #include "platform/wtf/CurrentTime.h" | 48 #include "platform/wtf/CurrentTime.h" |
| 49 #include "public/platform/Platform.h" | 49 #include "public/platform/Platform.h" |
| 50 #include "public/web/WebSettings.h" | 50 #include "public/web/WebSettings.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 386 } |
| 387 | 387 |
| 388 // All switch branches should return and we should never get here. | 388 // All switch branches should return and we should never get here. |
| 389 // But some compilers aren't sure, hence this default. | 389 // But some compilers aren't sure, hence this default. |
| 390 NOTREACHED(); | 390 NOTREACHED(); |
| 391 return WTF::Bind(CompileWithoutOptions, V8CompileHistogram::kCacheable); | 391 return WTF::Bind(CompileWithoutOptions, V8CompileHistogram::kCacheable); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // Select a compile function for a streaming compile. | 394 // Select a compile function for a streaming compile. |
| 395 CompileFn SelectCompileFunction(V8CacheOptions cache_options, | 395 CompileFn SelectCompileFunction(V8CacheOptions cache_options, |
| 396 ScriptResource* resource, | 396 const ScriptResourceData* resource, |
| 397 ScriptStreamer* streamer) { | 397 ScriptStreamer* streamer) { |
| 398 // We don't stream scripts which don't have a Resource. | 398 // We don't stream scripts which don't have a Resource. |
| 399 DCHECK(resource); | 399 DCHECK(resource); |
| 400 // Failed resources should never get this far. | 400 // Failed resources should never get this far. |
| 401 DCHECK(!resource->ErrorOccurred()); | 401 DCHECK(!resource->ErrorOccurred()); |
| 402 DCHECK(streamer->IsFinished()); | 402 DCHECK(streamer->IsFinished()); |
| 403 DCHECK(!streamer->StreamingSuppressed()); | 403 DCHECK(!streamer->StreamingSuppressed()); |
| 404 return WTF::Bind(PostStreamCompile, cache_options, | 404 return WTF::Bind(PostStreamCompile, cache_options, |
| 405 WrapPersistent(resource->CacheHandler()), | 405 WrapPersistent(resource->CacheHandler()), |
| 406 WrapPersistent(streamer)); | 406 WrapPersistent(streamer)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 cache_metadata_handler, access_control_status, | 444 cache_metadata_handler, access_control_status, |
| 445 v8_cache_options); | 445 v8_cache_options); |
| 446 } | 446 } |
| 447 | 447 |
| 448 v8::MaybeLocal<v8::Script> V8ScriptRunner::CompileScript( | 448 v8::MaybeLocal<v8::Script> V8ScriptRunner::CompileScript( |
| 449 ScriptState* script_state, | 449 ScriptState* script_state, |
| 450 v8::Local<v8::String> code, | 450 v8::Local<v8::String> code, |
| 451 const String& file_name, | 451 const String& file_name, |
| 452 const String& source_map_url, | 452 const String& source_map_url, |
| 453 const TextPosition& script_start_position, | 453 const TextPosition& script_start_position, |
| 454 ScriptResource* resource, | 454 const ScriptResourceData* resource, |
| 455 ScriptStreamer* streamer, | 455 ScriptStreamer* streamer, |
| 456 CachedMetadataHandler* cache_handler, | 456 CachedMetadataHandler* cache_handler, |
| 457 AccessControlStatus access_control_status, | 457 AccessControlStatus access_control_status, |
| 458 V8CacheOptions cache_options) { | 458 V8CacheOptions cache_options) { |
| 459 TRACE_EVENT2( | 459 TRACE_EVENT2( |
| 460 "v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(), | 460 "v8,devtools.timeline", "v8.compile", "fileName", file_name.Utf8(), |
| 461 "data", | 461 "data", |
| 462 InspectorCompileScriptEvent::Data(file_name, script_start_position)); | 462 InspectorCompileScriptEvent::Data(file_name, script_start_position)); |
| 463 // TODO(maxlg): probe will use a execution context once | 463 // TODO(maxlg): probe will use a execution context once |
| 464 // DocumentWriteEvaluator::EnsureEvaluationContext provide script state, see | 464 // DocumentWriteEvaluator::EnsureEvaluationContext provide script state, see |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate), | 791 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate), |
| 792 num_args, args, isolate); | 792 num_args, args, isolate); |
| 793 } | 793 } |
| 794 | 794 |
| 795 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsDefault, kV8CacheOptionsDefault); | 795 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsDefault, kV8CacheOptionsDefault); |
| 796 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsNone, kV8CacheOptionsNone); | 796 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsNone, kV8CacheOptionsNone); |
| 797 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsParse, kV8CacheOptionsParse); | 797 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsParse, kV8CacheOptionsParse); |
| 798 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsCode, kV8CacheOptionsCode); | 798 STATIC_ASSERT_ENUM(WebSettings::kV8CacheOptionsCode, kV8CacheOptionsCode); |
| 799 | 799 |
| 800 } // namespace blink | 800 } // namespace blink |
| OLD | NEW |