OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h" | 6 #include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h" |
7 | 7 |
8 #include "core/fetch/CachedMetadata.h" | 8 #include "core/fetch/CachedMetadata.h" |
9 #include "core/workers/WorkerGlobalScope.h" | 9 #include "core/workers/WorkerGlobalScope.h" |
10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 ServiceWorkerScriptCachedMetadataHandler::ServiceWorkerScriptCachedMetadataHandl
er(WorkerGlobalScope* workerGlobalScope, const KURL& scriptURL, const Vector<cha
r>* metaData) | 14 ServiceWorkerScriptCachedMetadataHandler::ServiceWorkerScriptCachedMetadataHandl
er(WorkerGlobalScope* workerGlobalScope, const KURL& scriptURL, const Vector<cha
r>* metaData) |
15 : m_workerGlobalScope(workerGlobalScope) | 15 : m_workerGlobalScope(workerGlobalScope) |
16 , m_scriptURL(scriptURL) | 16 , m_scriptURL(scriptURL) |
17 { | 17 { |
18 if (metaData) | 18 if (metaData) |
19 m_cachedMetadata = CachedMetadata::deserialize(metaData->data(), metaDat
a->size()); | 19 m_cachedMetadata = CachedMetadata::deserialize(metaData->data(), metaDat
a->size()); |
20 } | 20 } |
21 | 21 |
22 ServiceWorkerScriptCachedMetadataHandler::~ServiceWorkerScriptCachedMetadataHand
ler() | 22 ServiceWorkerScriptCachedMetadataHandler::~ServiceWorkerScriptCachedMetadataHand
ler() |
23 { | 23 { |
24 } | 24 } |
25 | 25 |
26 DEFINE_TRACE(ServiceWorkerScriptCachedMetadataHandler) | 26 DEFINE_TRACE(ServiceWorkerScriptCachedMetadataHandler) |
27 { | 27 { |
28 #if ENABLE(OILPAN) | |
29 visitor->trace(m_workerGlobalScope); | 28 visitor->trace(m_workerGlobalScope); |
30 #endif | |
31 CachedMetadataHandler::trace(visitor); | 29 CachedMetadataHandler::trace(visitor); |
32 } | 30 } |
33 | 31 |
34 void ServiceWorkerScriptCachedMetadataHandler::setCachedMetadata(unsigned dataTy
peID, const char* data, size_t size, CacheType type) | 32 void ServiceWorkerScriptCachedMetadataHandler::setCachedMetadata(unsigned dataTy
peID, const char* data, size_t size, CacheType type) |
35 { | 33 { |
36 if (type != SendToPlatform) | 34 if (type != SendToPlatform) |
37 return; | 35 return; |
38 m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size); | 36 m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size); |
39 const Vector<char>& serializedData = m_cachedMetadata->serialize(); | 37 const Vector<char>& serializedData = m_cachedMetadata->serialize(); |
40 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->setCachedMetadata
(m_scriptURL, serializedData.data(), serializedData.size()); | 38 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->setCachedMetadata
(m_scriptURL, serializedData.data(), serializedData.size()); |
(...skipping 13 matching lines...) Expand all Loading... |
54 return nullptr; | 52 return nullptr; |
55 return m_cachedMetadata.get(); | 53 return m_cachedMetadata.get(); |
56 } | 54 } |
57 | 55 |
58 String ServiceWorkerScriptCachedMetadataHandler::encoding() const | 56 String ServiceWorkerScriptCachedMetadataHandler::encoding() const |
59 { | 57 { |
60 return emptyString(); | 58 return emptyString(); |
61 } | 59 } |
62 | 60 |
63 } // namespace blink | 61 } // namespace blink |
OLD | NEW |