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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ScriptResource.cpp

Issue 1915833002: Introduce Platform::cacheMetadataInCacheStorage() to store V8 code cache in CacheStorage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textScript); 42 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textScript);
43 ScriptResource* resource = toScriptResource(fetcher->requestResource(request , ScriptResourceFactory())); 43 ScriptResource* resource = toScriptResource(fetcher->requestResource(request , ScriptResourceFactory()));
44 if (resource && !request.integrityMetadata().isEmpty()) 44 if (resource && !request.integrityMetadata().isEmpty())
45 resource->setIntegrityMetadata(request.integrityMetadata()); 45 resource->setIntegrityMetadata(request.integrityMetadata());
46 return resource; 46 return resource;
47 } 47 }
48 48
49 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, const Res ourceLoaderOptions& options, const String& charset) 49 ScriptResource::ScriptResource(const ResourceRequest& resourceRequest, const Res ourceLoaderOptions& options, const String& charset)
50 : TextResource(resourceRequest, Script, options, "application/javascript", c harset) 50 : TextResource(resourceRequest, Script, options, "application/javascript", c harset)
51 , m_integrityDisposition(ScriptIntegrityDisposition::NotChecked) 51 , m_integrityDisposition(ScriptIntegrityDisposition::NotChecked)
52 , m_v8CacheStrategiesForCacheStorage(V8CacheStrategiesForCacheStorageDefault )
52 { 53 {
53 } 54 }
54 55
55 ScriptResource::~ScriptResource() 56 ScriptResource::~ScriptResource()
56 { 57 {
57 } 58 }
58 59
59 void ScriptResource::didAddClient(ResourceClient* client) 60 void ScriptResource::didAddClient(ResourceClient* client)
60 { 61 {
61 ASSERT(ScriptResourceClient::isExpectedType(client)); 62 ASSERT(ScriptResourceClient::isExpectedType(client));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 m_integrityDisposition = disposition; 114 m_integrityDisposition = disposition;
114 } 115 }
115 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque st) const 116 bool ScriptResource::mustRefetchDueToIntegrityMetadata(const FetchRequest& reque st) const
116 { 117 {
117 if (request.integrityMetadata().isEmpty()) 118 if (request.integrityMetadata().isEmpty())
118 return false; 119 return false;
119 120
120 return !IntegrityMetadata::setsEqual(m_integrityMetadata, request.integrityM etadata()); 121 return !IntegrityMetadata::setsEqual(m_integrityMetadata, request.integrityM etadata());
121 } 122 }
122 123
124 bool ScriptResource::cacheMetadataSendToPlatformDisabled() const
125 {
126 if (m_response.cacheStorageCacheName().isNull())
127 return false;
128 // Currently we don't support V8 code cache in CacheStorage by default.
129 return m_v8CacheStrategiesForCacheStorage == V8CacheStrategiesForCacheStorag eNone || m_v8CacheStrategiesForCacheStorage == V8CacheStrategiesForCacheStorageD efault;
130 }
131
132 bool ScriptResource::shouldAggressivelyCacheMetadata() const
133 {
134 return !m_response.cacheStorageCacheName().isNull() && m_v8CacheStrategiesFo rCacheStorage == V8CacheStrategiesForCacheStorageAggressive;
135 }
136
123 } // namespace blink 137 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698