Chromium Code Reviews| 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 #if ENABLE(OILPAN) | |
|
haraken
2015/07/15 07:48:02
We normally add #if ENABLE(OILPAN) inside the trac
Yuta Kitamura
2015/07/15 08:05:34
Do you mean I should define the trace function eve
haraken
2015/07/15 08:06:50
I don't know if it makes sense, but we're doing th
Yuta Kitamura
2015/07/15 08:11:03
OK, will address in the next patchset.
Yuta Kitamura
2015/07/15 08:20:58
Done, landing.
| |
| 27 DEFINE_TRACE(ServiceWorkerScriptCachedMetadataHandler) | |
| 28 { | |
| 29 visitor->trace(m_workerGlobalScope); | |
| 30 CachedMetadataHandler::trace(visitor); | |
| 31 } | |
| 32 #endif | |
| 33 | |
| 26 void ServiceWorkerScriptCachedMetadataHandler::setCachedMetadata(unsigned dataTy peID, const char* data, size_t size, CacheType type) | 34 void ServiceWorkerScriptCachedMetadataHandler::setCachedMetadata(unsigned dataTy peID, const char* data, size_t size, CacheType type) |
| 27 { | 35 { |
| 28 if (type != SendToPlatform) | 36 if (type != SendToPlatform) |
| 29 return; | 37 return; |
| 30 m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size); | 38 m_cachedMetadata = CachedMetadata::create(dataTypeID, data, size); |
| 31 const Vector<char>& serializedData = m_cachedMetadata->serialize(); | 39 const Vector<char>& serializedData = m_cachedMetadata->serialize(); |
| 32 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->setCachedMetadata (m_scriptURL, serializedData.data(), serializedData.size()); | 40 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->setCachedMetadata (m_scriptURL, serializedData.data(), serializedData.size()); |
| 33 } | 41 } |
| 34 | 42 |
| 35 void ServiceWorkerScriptCachedMetadataHandler::clearCachedMetadata(CacheType typ e) | 43 void ServiceWorkerScriptCachedMetadataHandler::clearCachedMetadata(CacheType typ e) |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 46 return nullptr; | 54 return nullptr; |
| 47 return m_cachedMetadata.get(); | 55 return m_cachedMetadata.get(); |
| 48 } | 56 } |
| 49 | 57 |
| 50 String ServiceWorkerScriptCachedMetadataHandler::encoding() const | 58 String ServiceWorkerScriptCachedMetadataHandler::encoding() const |
| 51 { | 59 { |
| 52 return emptyString(); | 60 return emptyString(); |
| 53 } | 61 } |
| 54 | 62 |
| 55 } // namespace blink | 63 } // namespace blink |
| OLD | NEW |