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

Side by Side Diff: third_party/WebKit/Source/modules/storage/StorageArea.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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) 2009 Google Inc. All Rights Reserved. 2 * Copyright (C) 2009 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef StorageArea_h 26 #ifndef StorageArea_h
27 #define StorageArea_h 27 #define StorageArea_h
28 28
29 #include "core/frame/LocalFrameLifecycleObserver.h" 29 #include "core/frame/LocalFrameLifecycleObserver.h"
30 #include "modules/ModulesExport.h" 30 #include "modules/ModulesExport.h"
31 #include "platform/heap/Handle.h" 31 #include "platform/heap/Handle.h"
32 #include "wtf/OwnPtr.h"
33 #include "wtf/PassOwnPtr.h"
32 #include "wtf/text/WTFString.h" 34 #include "wtf/text/WTFString.h"
33 #include <memory>
34 35
35 namespace blink { 36 namespace blink {
36 37
37 class ExceptionState; 38 class ExceptionState;
38 class LocalFrame; 39 class LocalFrame;
39 class KURL; 40 class KURL;
40 class SecurityOrigin; 41 class SecurityOrigin;
41 class Storage; 42 class Storage;
42 class WebStorageArea; 43 class WebStorageArea;
43 class WebStorageNamespace; 44 class WebStorageNamespace;
44 45
45 enum StorageType { 46 enum StorageType {
46 LocalStorage, 47 LocalStorage,
47 SessionStorage 48 SessionStorage
48 }; 49 };
49 50
50 class MODULES_EXPORT StorageArea final : public GarbageCollectedFinalized<Storag eArea>, public LocalFrameLifecycleObserver { 51 class MODULES_EXPORT StorageArea final : public GarbageCollectedFinalized<Storag eArea>, public LocalFrameLifecycleObserver {
51 USING_GARBAGE_COLLECTED_MIXIN(StorageArea); 52 USING_GARBAGE_COLLECTED_MIXIN(StorageArea);
52 public: 53 public:
53 static StorageArea* create(std::unique_ptr<WebStorageArea>, StorageType); 54 static StorageArea* create(PassOwnPtr<WebStorageArea>, StorageType);
54 55
55 virtual ~StorageArea(); 56 virtual ~StorageArea();
56 57
57 // The HTML5 DOM Storage API 58 // The HTML5 DOM Storage API
58 unsigned length(ExceptionState&, LocalFrame* sourceFrame); 59 unsigned length(ExceptionState&, LocalFrame* sourceFrame);
59 String key(unsigned index, ExceptionState&, LocalFrame* sourceFrame); 60 String key(unsigned index, ExceptionState&, LocalFrame* sourceFrame);
60 String getItem(const String& key, ExceptionState&, LocalFrame* sourceFrame); 61 String getItem(const String& key, ExceptionState&, LocalFrame* sourceFrame);
61 void setItem(const String& key, const String& value, ExceptionState&, LocalF rame* sourceFrame); 62 void setItem(const String& key, const String& value, ExceptionState&, LocalF rame* sourceFrame);
62 void removeItem(const String& key, ExceptionState&, LocalFrame* sourceFrame) ; 63 void removeItem(const String& key, ExceptionState&, LocalFrame* sourceFrame) ;
63 void clear(ExceptionState&, LocalFrame* sourceFrame); 64 void clear(ExceptionState&, LocalFrame* sourceFrame);
64 bool contains(const String& key, ExceptionState&, LocalFrame* sourceFrame); 65 bool contains(const String& key, ExceptionState&, LocalFrame* sourceFrame);
65 66
66 bool canAccessStorage(LocalFrame*); 67 bool canAccessStorage(LocalFrame*);
67 68
68 static void dispatchLocalStorageEvent(const String& key, const String& oldVa lue, const String& newValue, 69 static void dispatchLocalStorageEvent(const String& key, const String& oldVa lue, const String& newValue,
69 SecurityOrigin*, const KURL& pageURL, WebStorageArea* sourceAreaInstance ); 70 SecurityOrigin*, const KURL& pageURL, WebStorageArea* sourceAreaInstance );
70 static void dispatchSessionStorageEvent(const String& key, const String& old Value, const String& newValue, 71 static void dispatchSessionStorageEvent(const String& key, const String& old Value, const String& newValue,
71 SecurityOrigin*, const KURL& pageURL, const WebStorageNamespace&, WebSto rageArea* sourceAreaInstance); 72 SecurityOrigin*, const KURL& pageURL, const WebStorageNamespace&, WebSto rageArea* sourceAreaInstance);
72 73
73 DECLARE_TRACE(); 74 DECLARE_TRACE();
74 75
75 private: 76 private:
76 StorageArea(std::unique_ptr<WebStorageArea>, StorageType); 77 StorageArea(PassOwnPtr<WebStorageArea>, StorageType);
77 78
78 static bool isEventSource(Storage*, WebStorageArea* sourceAreaInstance); 79 static bool isEventSource(Storage*, WebStorageArea* sourceAreaInstance);
79 80
80 std::unique_ptr<WebStorageArea> m_storageArea; 81 OwnPtr<WebStorageArea> m_storageArea;
81 StorageType m_storageType; 82 StorageType m_storageType;
82 bool m_canAccessStorageCachedResult; 83 bool m_canAccessStorageCachedResult;
83 }; 84 };
84 85
85 } // namespace blink 86 } // namespace blink
86 87
87 #endif // StorageArea_h 88 #endif // StorageArea_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/storage/Storage.cpp ('k') | third_party/WebKit/Source/modules/storage/StorageArea.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698