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

Unified Diff: content/child/quota_message_filter.h

Issue 20015002: Make Platform::queryStorageUsageAndQuota work from worker threads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/quota_dispatcher.cc ('k') | content/child/quota_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/quota_message_filter.h
diff --git a/content/child/quota_message_filter.h b/content/child/quota_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..5e90c6ccc83a1a61930010ea31d5a07e600d7d22
--- /dev/null
+++ b/content/child/quota_message_filter.h
@@ -0,0 +1,51 @@
+// Copyright 2013 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 CONTENT_CHILD_QUOTA_MESSAGE_FILTER_H_
+#define CONTENT_CHILD_QUOTA_MESSAGE_FILTER_H_
+
+#include <map>
+
+#include "base/synchronization/lock.h"
+#include "ipc/ipc_channel_proxy.h"
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace content {
+
+class ThreadSafeSender;
+
+class QuotaMessageFilter : public IPC::ChannelProxy::MessageFilter {
+ public:
+ explicit QuotaMessageFilter(ThreadSafeSender* thread_safe_sender);
+
+ // IPC::Listener implementation.
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
+
+ // Registers { request_id, thread_id } map to the message filter.
+ // This method can be called on any thread.
+ void RegisterRequestID(int request_id, int thread_id);
+
+ protected:
+ virtual ~QuotaMessageFilter();
+
+ private:
+ typedef std::map<int, int> RequestIdToThreadId;
+
+ void DispatchMessage(const IPC::Message& msg);
+
+ scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
+ scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+
+ base::Lock request_id_map_lock_;
+ RequestIdToThreadId request_id_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(QuotaMessageFilter);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_QUOTA_MESSAGE_FILTER_H_
« no previous file with comments | « content/child/quota_dispatcher.cc ('k') | content/child/quota_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698