OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/InspectorServiceWorkerCacheAgent.h" | 6 #include "modules/cachestorage/InspectorCacheStorageAgent.h" |
7 | 7 |
8 #include "core/InspectorBackendDispatcher.h" | 8 #include "core/InspectorBackendDispatcher.h" |
9 #include "core/InspectorTypeBuilder.h" | 9 #include "core/InspectorTypeBuilder.h" |
10 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 10 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
11 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | |
12 #include "platform/JSONValues.h" | 11 #include "platform/JSONValues.h" |
13 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
14 #include "platform/weborigin/DatabaseIdentifier.h" | 13 #include "platform/weborigin/DatabaseIdentifier.h" |
15 #include "public/platform/Platform.h" | 14 #include "public/platform/Platform.h" |
16 #include "public/platform/WebServiceWorkerCache.h" | 15 #include "public/platform/WebServiceWorkerCache.h" |
17 #include "public/platform/WebServiceWorkerCacheError.h" | 16 #include "public/platform/WebServiceWorkerCacheError.h" |
18 #include "public/platform/WebServiceWorkerCacheStorage.h" | 17 #include "public/platform/WebServiceWorkerCacheStorage.h" |
19 #include "public/platform/WebServiceWorkerRequest.h" | 18 #include "public/platform/WebServiceWorkerRequest.h" |
20 #include "public/platform/WebServiceWorkerResponse.h" | 19 #include "public/platform/WebServiceWorkerResponse.h" |
21 #include "public/platform/WebString.h" | 20 #include "public/platform/WebString.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 { | 282 { |
284 m_callback->sendFailure(String::format("Error requesting cache names: %s
", serviceWorkerCacheErrorString(error).data())); | 283 m_callback->sendFailure(String::format("Error requesting cache names: %s
", serviceWorkerCacheErrorString(error).data())); |
285 } | 284 } |
286 | 285 |
287 private: | 286 private: |
288 RefPtrWillBePersistent<DeleteCacheCallback> m_callback; | 287 RefPtrWillBePersistent<DeleteCacheCallback> m_callback; |
289 }; | 288 }; |
290 | 289 |
291 } // namespace | 290 } // namespace |
292 | 291 |
293 InspectorServiceWorkerCacheAgent::InspectorServiceWorkerCacheAgent(ServiceWorker
GlobalScope* scope) | 292 InspectorCacheStorageAgent::InspectorCacheStorageAgent(ServiceWorkerGlobalScope*
scope) |
294 : InspectorBaseAgent<blink::InspectorServiceWorkerCacheAgent, InspectorFront
end::ServiceWorkerCache>("ServiceWorkerCache") | 293 : InspectorBaseAgent<blink::InspectorCacheStorageAgent, InspectorFrontend::S
erviceWorkerCache>("ServiceWorkerCache") |
295 , m_globalScope(scope) | 294 , m_globalScope(scope) |
296 { | 295 { |
297 } | 296 } |
298 | 297 |
299 InspectorServiceWorkerCacheAgent::~InspectorServiceWorkerCacheAgent() { } | 298 InspectorCacheStorageAgent::~InspectorCacheStorageAgent() { } |
300 | 299 |
301 DEFINE_TRACE(InspectorServiceWorkerCacheAgent) | 300 DEFINE_TRACE(InspectorCacheStorageAgent) |
302 { | 301 { |
303 InspectorBaseAgent::trace(visitor); | 302 InspectorBaseAgent::trace(visitor); |
304 } | 303 } |
305 | 304 |
306 void InspectorServiceWorkerCacheAgent::requestCacheNames(ErrorString* errorStrin
g, PassRefPtrWillBeRawPtr<RequestCacheNamesCallback> callback) | 305 void InspectorCacheStorageAgent::requestCacheNames(ErrorString* errorString, Pas
sRefPtrWillBeRawPtr<RequestCacheNamesCallback> callback) |
307 { | 306 { |
308 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
m_globalScope); | 307 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
m_globalScope); |
309 if (!cache) { | 308 if (!cache) { |
310 callback->sendFailure(*errorString); | 309 callback->sendFailure(*errorString); |
311 return; | 310 return; |
312 } | 311 } |
313 cache->dispatchKeys(new RequestCacheNames(callback)); | 312 cache->dispatchKeys(new RequestCacheNames(callback)); |
314 } | 313 } |
315 | 314 |
316 | 315 |
317 void InspectorServiceWorkerCacheAgent::requestEntries(ErrorString* errorString,
const String& cacheName, int skipCount, int pageSize, PassRefPtrWillBeRawPtr<Req
uestEntriesCallback> callback) | 316 void InspectorCacheStorageAgent::requestEntries(ErrorString* errorString, const
String& cacheName, int skipCount, int pageSize, PassRefPtrWillBeRawPtr<RequestEn
triesCallback> callback) |
318 { | 317 { |
319 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
m_globalScope); | 318 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
m_globalScope); |
320 if (!cache) { | 319 if (!cache) { |
321 callback->sendFailure(*errorString); | 320 callback->sendFailure(*errorString); |
322 return; | 321 return; |
323 } | 322 } |
324 DataRequestParams params; | 323 DataRequestParams params; |
325 params.cacheName = cacheName; | 324 params.cacheName = cacheName; |
326 params.pageSize = pageSize; | 325 params.pageSize = pageSize; |
327 params.skipCount = skipCount; | 326 params.skipCount = skipCount; |
328 cache->dispatchOpen(new GetCacheForRequestData(params, callback), WebString(
cacheName)); | 327 cache->dispatchOpen(new GetCacheForRequestData(params, callback), WebString(
cacheName)); |
329 } | 328 } |
330 | 329 |
331 void InspectorServiceWorkerCacheAgent::deleteCache(ErrorString* errorString, con
st String& cacheName, PassRefPtrWillBeRawPtr<DeleteCacheCallback> callback) | 330 void InspectorCacheStorageAgent::deleteCache(ErrorString* errorString, const Str
ing& cacheName, PassRefPtrWillBeRawPtr<DeleteCacheCallback> callback) |
332 { | 331 { |
333 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
m_globalScope); | 332 OwnPtr<WebServiceWorkerCacheStorage> cache = assertCacheStorage(errorString,
m_globalScope); |
334 if (!cache) { | 333 if (!cache) { |
335 callback->sendFailure(*errorString); | 334 callback->sendFailure(*errorString); |
336 return; | 335 return; |
337 } | 336 } |
338 cache->dispatchDelete(new DeleteCache(callback), WebString(cacheName)); | 337 cache->dispatchDelete(new DeleteCache(callback), WebString(cacheName)); |
339 } | 338 } |
340 | 339 |
341 } // namespace blink | 340 } // namespace blink |
OLD | NEW |