Commit 95670db5 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Move logic for IsServedFromCacheStorage() to V8CodeCache

Bug: 841466
Change-Id: I4b08f6b67049ca22ac083c3b6cbb7954a5f1400f
Reviewed-on: https://chromium-review.googlesource.com/1058709
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarMythri Alle <mythria@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566037}
parent 2d9ea2af
...@@ -83,25 +83,6 @@ void ScriptController::UpdateSecurityOrigin( ...@@ -83,25 +83,6 @@ void ScriptController::UpdateSecurityOrigin(
window_proxy_manager_->UpdateSecurityOrigin(security_origin); window_proxy_manager_->UpdateSecurityOrigin(security_origin);
} }
namespace {
V8CacheOptions CacheOptions(const CachedMetadataHandler* cache_handler,
const Settings* settings) {
V8CacheOptions v8_cache_options(kV8CacheOptionsDefault);
if (settings) {
v8_cache_options = settings->GetV8CacheOptions();
if (v8_cache_options == kV8CacheOptionsNone)
return kV8CacheOptionsNone;
}
// If the resource is served from CacheStorage, generate the V8 code cache in
// the first load.
if (cache_handler && cache_handler->IsServedFromCacheStorage())
return kV8CacheOptionsCodeWithoutHeatCheck;
return v8_cache_options;
}
} // namespace
v8::Local<v8::Value> ScriptController::ExecuteScriptAndReturnValue( v8::Local<v8::Value> ScriptController::ExecuteScriptAndReturnValue(
v8::Local<v8::Context> context, v8::Local<v8::Context> context,
const ScriptSourceCode& source, const ScriptSourceCode& source,
...@@ -114,10 +95,9 @@ v8::Local<v8::Value> ScriptController::ExecuteScriptAndReturnValue( ...@@ -114,10 +95,9 @@ v8::Local<v8::Value> ScriptController::ExecuteScriptAndReturnValue(
source.StartPosition())); source.StartPosition()));
v8::Local<v8::Value> result; v8::Local<v8::Value> result;
{ {
CachedMetadataHandler* cache_handler = source.CacheHandler(); V8CacheOptions v8_cache_options = kV8CacheOptionsDefault;
if (const Settings* settings = GetFrame()->GetSettings())
V8CacheOptions v8_cache_options = v8_cache_options = settings->GetV8CacheOptions();
CacheOptions(cache_handler, GetFrame()->GetSettings());
// Isolate exceptions that occur when compiling and executing // Isolate exceptions that occur when compiling and executing
// the code. These exceptions should not interfere with // the code. These exceptions should not interfere with
......
...@@ -133,6 +133,11 @@ V8CodeCache::GetCompileOptions(V8CacheOptions cache_options, ...@@ -133,6 +133,11 @@ V8CodeCache::GetCompileOptions(V8CacheOptions cache_options,
no_cache_reason); no_cache_reason);
} }
// If the resource is served from CacheStorage, generate the V8 code cache in
// the first load.
if (cache_handler->IsServedFromCacheStorage())
cache_options = kV8CacheOptionsCodeWithoutHeatCheck;
switch (cache_options) { switch (cache_options) {
case kV8CacheOptionsDefault: case kV8CacheOptionsDefault:
case kV8CacheOptionsCode: case kV8CacheOptionsCode:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment