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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.h

Issue 1051023002: Expose Cache Storage API in the global scope in stable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 32
33 #include "bindings/modules/v8/UnionTypesModules.h" 33 #include "bindings/modules/v8/UnionTypesModules.h"
34 #include "core/workers/WorkerGlobalScope.h" 34 #include "core/workers/WorkerGlobalScope.h"
35 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
36 #include "wtf/Assertions.h" 36 #include "wtf/Assertions.h"
37 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
38 #include "wtf/RefCounted.h" 38 #include "wtf/RefCounted.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 class CacheStorage;
43 class Dictionary; 42 class Dictionary;
44 class Request; 43 class Request;
45 class ScriptPromise; 44 class ScriptPromise;
46 class ScriptState; 45 class ScriptState;
47 class ServiceWorkerClients; 46 class ServiceWorkerClients;
48 class ServiceWorkerRegistration; 47 class ServiceWorkerRegistration;
49 class ServiceWorkerThread; 48 class ServiceWorkerThread;
50 class WaitUntilObserver; 49 class WaitUntilObserver;
51 class WebServiceWorkerRegistration; 50 class WebServiceWorkerRegistration;
52 class WorkerThreadStartupData; 51 class WorkerThreadStartupData;
53 52
54 typedef RequestOrUSVString RequestInfo; 53 typedef RequestOrUSVString RequestInfo;
55 54
56 class ServiceWorkerGlobalScope final : public WorkerGlobalScope { 55 class ServiceWorkerGlobalScope final : public WorkerGlobalScope {
57 DEFINE_WRAPPERTYPEINFO(); 56 DEFINE_WRAPPERTYPEINFO();
58 public: 57 public:
59 static PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> create(ServiceWorker Thread*, PassOwnPtr<WorkerThreadStartupData>); 58 static PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> create(ServiceWorker Thread*, PassOwnPtr<WorkerThreadStartupData>);
60 59
61 virtual ~ServiceWorkerGlobalScope(); 60 virtual ~ServiceWorkerGlobalScope();
62 virtual bool isServiceWorkerGlobalScope() const override { return true; } 61 virtual bool isServiceWorkerGlobalScope() const override { return true; }
63 62
64 // WorkerGlobalScope 63 // WorkerGlobalScope
65 virtual void didEvaluateWorkerScript() override; 64 virtual void didEvaluateWorkerScript() override;
66 65
67 // ServiceWorkerGlobalScope.idl 66 // ServiceWorkerGlobalScope.idl
68 ServiceWorkerClients* clients(); 67 ServiceWorkerClients* clients();
69 ServiceWorkerRegistration* registration(); 68 ServiceWorkerRegistration* registration();
70 69
71 CacheStorage* caches(ExecutionContext*);
72
73 ScriptPromise fetch(ScriptState*, const RequestInfo&, const Dictionary&, Exc eptionState&); 70 ScriptPromise fetch(ScriptState*, const RequestInfo&, const Dictionary&, Exc eptionState&);
74 71
75 void close(ExceptionState&); 72 void close(ExceptionState&);
76 73
77 ScriptPromise skipWaiting(ScriptState*); 74 ScriptPromise skipWaiting(ScriptState*);
78 75
79 void setRegistration(WebServiceWorkerRegistration*); 76 void setRegistration(WebServiceWorkerRegistration*);
80 77
81 // EventTarget 78 // EventTarget
82 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) override; 79 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) override;
(...skipping 14 matching lines...) Expand all
97 class SkipWaitingCallback; 94 class SkipWaitingCallback;
98 95
99 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker Thread*, double timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<Worker Clients>); 96 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker Thread*, double timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<Worker Clients>);
100 void importScripts(const Vector<String>& urls, ExceptionState&) override; 97 void importScripts(const Vector<String>& urls, ExceptionState&) override;
101 PassOwnPtr<CachedMetadataHandler> createWorkerScriptCachedMetadataHandler(co nst KURL& scriptURL, const Vector<char>* metaData) override; 98 PassOwnPtr<CachedMetadataHandler> createWorkerScriptCachedMetadataHandler(co nst KURL& scriptURL, const Vector<char>* metaData) override;
102 void logExceptionToConsole(const String& errorMessage, int scriptId, const S tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip tCallStack>) override; 99 void logExceptionToConsole(const String& errorMessage, int scriptId, const S tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip tCallStack>) override;
103 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; 100 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override;
104 101
105 PersistentWillBeMember<ServiceWorkerClients> m_clients; 102 PersistentWillBeMember<ServiceWorkerClients> m_clients;
106 PersistentWillBeMember<ServiceWorkerRegistration> m_registration; 103 PersistentWillBeMember<ServiceWorkerRegistration> m_registration;
107 PersistentWillBeMember<CacheStorage> m_caches;
108 bool m_didEvaluateScript; 104 bool m_didEvaluateScript;
109 bool m_hadErrorInTopLevelEventHandler; 105 bool m_hadErrorInTopLevelEventHandler;
110 unsigned m_eventNestingLevel; 106 unsigned m_eventNestingLevel;
111 size_t m_scriptCount; 107 size_t m_scriptCount;
112 size_t m_scriptTotalSize; 108 size_t m_scriptTotalSize;
113 size_t m_scriptCachedMetadataTotalSize; 109 size_t m_scriptCachedMetadataTotalSize;
114 }; 110 };
115 111
116 } // namespace blink 112 } // namespace blink
117 113
118 #endif // ServiceWorkerGlobalScope_h 114 #endif // ServiceWorkerGlobalScope_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698