Chromium Code Reviews| Index: webkit/dom_storage/dom_storage_host.h |
| =================================================================== |
| --- webkit/dom_storage/dom_storage_host.h (revision 0) |
| +++ webkit/dom_storage/dom_storage_host.h (revision 0) |
| @@ -0,0 +1,59 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
| +#define WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
| +#pragma once |
| + |
| +#include <map> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/nullable_string16.h" |
| +#include "base/string16.h" |
| + |
| +class GURL; |
| + |
| +namespace dom_storage { |
| + |
| +class DOMStorageContext; |
| +class DOMStorageHost; |
| +class DOMStorageNamespace; |
| +class DOMStorageArea; |
| + |
| +// One instance is allocated in the main process for each client process. |
| +// Used by DOMStorageMessageFilter in Chrome and by SimpleDOMStorage in DRT. |
| +// This class is single threaded, and performs blocking file reads/writes, |
| +// so it shouldn't be used on chrome's IO thread. |
| +class DOMStorageHost { |
| + public: |
| + DOMStorageHost(DOMStorageContext* context); |
| + ~DOMStorageHost(); |
| + |
| + int OpenStorageArea(int namespace_id, const GURL& origin); |
| + void CloseStorageArea(int connection_id); |
| + |
| + int GetAreaLength(int connection_id); |
| + NullableString16 GetKey(int connection_id, int index); |
|
jsbell
2012/01/24 19:37:25
Nit: The naming here is slightly inconsistent - wh
|
| + NullableString16 GetItem(int connection_id, const string16& key); |
| + bool SetItem(int connection_id, const string16& key, |
| + const string16& value, const GURL& page_url, |
| + NullableString16* old_value); |
| + bool RemoveItem(int connection_id, const string16& key, |
| + const GURL& page_url, |
| + NullableString16* old_value); |
| + bool ClearArea(int connection_id, const GURL& page_url); |
| + |
| + private: |
| + typedef std::map<int, scoped_refptr<DOMStorageArea> > AreaMap; |
| + |
| + DOMStorageArea* GetOpenArea(int connection_id); |
| + |
| + int last_connection_id_; |
| + scoped_refptr<DOMStorageContext> context_; |
| + AreaMap connections_; |
| +}; |
| + |
| +} // namespace dom_storage |
| + |
| +#endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_ |
| Property changes on: webkit\dom_storage\dom_storage_host.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |