| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 | 11 |
| 11 class GURL; | 12 class GURL; |
| 12 struct DOMStorageMsg_Event_Params; | 13 struct DOMStorageMsg_Event_Params; |
| 13 | 14 |
| 14 namespace IPC { | 15 namespace IPC { |
| 15 class Message; | 16 class Message; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 class DOMStorageCachedArea; | 21 class DOMStorageCachedArea; |
| 21 | 22 |
| 22 // Dispatches DomStorage related messages sent to a renderer process from the | 23 // Dispatches DomStorage related messages sent to a renderer process from the |
| 23 // main browser process. There is one instance per child process. Messages | 24 // main browser process. There is one instance per child process. Messages |
| 24 // are dispatched on the main renderer thread. The RenderThreadImpl | 25 // are dispatched on the main renderer thread. The RenderThreadImpl |
| 25 // creates an instance and delegates calls to it. This classes also manages | 26 // creates an instance and delegates calls to it. This classes also manages |
| 26 // the collection of DOMStorageCachedAreas that are active in the process. | 27 // the collection of DOMStorageCachedAreas that are active in the process. |
| 27 class DomStorageDispatcher { | 28 class DomStorageDispatcher { |
| 28 public: | 29 public: |
| 29 DomStorageDispatcher(); | 30 DomStorageDispatcher(); |
| 30 ~DomStorageDispatcher(); | 31 ~DomStorageDispatcher(); |
| 31 | 32 |
| 32 // Each call to open should be balanced with a call to close. | 33 // Each call to open should be balanced with a call to close. |
| 33 scoped_refptr<DOMStorageCachedArea> OpenCachedArea(int connection_id, | 34 scoped_refptr<DOMStorageCachedArea> OpenCachedArea(int connection_id, |
| 34 int64 namespace_id, | 35 int64_t namespace_id, |
| 35 const GURL& origin); | 36 const GURL& origin); |
| 36 void CloseCachedArea(int connection_id, DOMStorageCachedArea* area); | 37 void CloseCachedArea(int connection_id, DOMStorageCachedArea* area); |
| 37 | 38 |
| 38 bool OnMessageReceived(const IPC::Message& msg); | 39 bool OnMessageReceived(const IPC::Message& msg); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 class ProxyImpl; | 42 class ProxyImpl; |
| 42 | 43 |
| 43 // IPC message handlers | 44 // IPC message handlers |
| 44 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); | 45 void OnStorageEvent(const DOMStorageMsg_Event_Params& params); |
| 45 void OnAsyncOperationComplete(bool success); | 46 void OnAsyncOperationComplete(bool success); |
| 46 | 47 |
| 47 scoped_refptr<ProxyImpl> proxy_; | 48 scoped_refptr<ProxyImpl> proxy_; |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace content | 51 } // namespace content |
| 51 | 52 |
| 52 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ | 53 #endif // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_DISPATCHER_H_ |
| OLD | NEW |