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 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" | 5 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "content/common/dom_storage/dom_storage_messages.h" | 12 #include "content/common/dom_storage/dom_storage_messages.h" |
13 #include "content/common/dom_storage/dom_storage_types.h" | 13 #include "content/common/dom_storage/dom_storage_types.h" |
14 #include "content/renderer/dom_storage/dom_storage_cached_area.h" | 14 #include "content/renderer/dom_storage/dom_storage_cached_area.h" |
15 #include "content/renderer/dom_storage/dom_storage_proxy.h" | 15 #include "content/renderer/dom_storage/dom_storage_proxy.h" |
16 #include "content/renderer/dom_storage/webstoragearea_impl.h" | 16 #include "content/renderer/dom_storage/webstoragearea_impl.h" |
17 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 17 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 19 #include "ipc/message_filter.h" |
19 #include "third_party/WebKit/public/platform/Platform.h" | 20 #include "third_party/WebKit/public/platform/Platform.h" |
20 #include "third_party/WebKit/public/web/WebKit.h" | 21 #include "third_party/WebKit/public/web/WebKit.h" |
21 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" | 22 #include "third_party/WebKit/public/web/WebStorageEventDispatcher.h" |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 | 25 |
25 namespace { | 26 namespace { |
26 // MessageThrottlingFilter ------------------------------------------- | 27 // MessageThrottlingFilter ------------------------------------------- |
27 // Used to limit the number of ipc messages pending completion so we | 28 // Used to limit the number of ipc messages pending completion so we |
28 // don't overwhelm the main browser process. When the limit is reached, | 29 // don't overwhelm the main browser process. When the limit is reached, |
29 // a synchronous message is sent to flush all pending messages thru. | 30 // a synchronous message is sent to flush all pending messages thru. |
30 // We expect to receive an 'ack' for each message sent. This object | 31 // We expect to receive an 'ack' for each message sent. This object |
31 // observes receipt of the acks on the IPC thread to decrement a counter. | 32 // observes receipt of the acks on the IPC thread to decrement a counter. |
32 class MessageThrottlingFilter : public IPC::ChannelProxy::MessageFilter { | 33 class MessageThrottlingFilter : public IPC::MessageFilter { |
33 public: | 34 public: |
34 explicit MessageThrottlingFilter(RenderThreadImpl* sender) | 35 explicit MessageThrottlingFilter(RenderThreadImpl* sender) |
35 : pending_count_(0), sender_(sender) {} | 36 : pending_count_(0), sender_(sender) {} |
36 | 37 |
37 void SendThrottled(IPC::Message* message); | 38 void SendThrottled(IPC::Message* message); |
38 void Shutdown() { sender_ = NULL; } | 39 void Shutdown() { sender_ = NULL; } |
39 | 40 |
40 private: | 41 private: |
41 virtual ~MessageThrottlingFilter() {} | 42 virtual ~MessageThrottlingFilter() {} |
42 | 43 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 355 |
355 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { | 356 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { |
356 proxy_->CompleteOnePendingCallback(success); | 357 proxy_->CompleteOnePendingCallback(success); |
357 } | 358 } |
358 | 359 |
359 void DomStorageDispatcher::OnResetCachedValues(int64 namespace_id) { | 360 void DomStorageDispatcher::OnResetCachedValues(int64 namespace_id) { |
360 proxy_->ResetAllCachedAreas(namespace_id); | 361 proxy_->ResetAllCachedAreas(namespace_id); |
361 } | 362 } |
362 | 363 |
363 } // namespace content | 364 } // namespace content |
OLD | NEW |