Index: content/child/high_priority_resource_filter.h |
diff --git a/content/child/high_priority_resource_filter.h b/content/child/high_priority_resource_filter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..db3d6bb986d03c8459613670581c2faa6708f3c1 |
--- /dev/null |
+++ b/content/child/high_priority_resource_filter.h |
@@ -0,0 +1,49 @@ |
+// Copyright 2014 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_HIGH_PRIORITY_RESOURCE_FILTER_H_ |
+#define CONTENT_CHILD_HIGH_PRIORITY_RESOURCE_FILTER_H_ |
+ |
+#include <set> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/synchronization/lock.h" |
+#include "ipc/message_filter.h" |
+#include "webkit/common/resource_type.h" |
+ |
+namespace base { |
+class HighPriorityTaskRunner; |
+} |
+ |
+namespace content { |
+class ResourceDispatcher; |
+ |
+class HighPriorityResourceFilter : public IPC::MessageFilter { |
+ public: |
+ HighPriorityResourceFilter( |
+ ResourceDispatcher* resource_dispatcher, |
+ scoped_refptr<base::HighPriorityTaskRunner> runner); |
+ |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ void AddPendingRequest(int request_id, ResourceType::Type resource_type); |
+ void RemovePendingRequest(int request_id); |
+ |
+ private: |
+ virtual ~HighPriorityResourceFilter(); |
+ |
+ bool IsHighPriorityResourceResonse(const IPC::Message& message); |
+ |
+ ResourceDispatcher* resource_dispatcher_; |
+ scoped_refptr<base::HighPriorityTaskRunner> runner_; |
+ |
+ std::set<int> request_ids_; |
+ base::Lock request_ids_lock_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HighPriorityResourceFilter); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_CHILD_HIGH_PRIORITY_RESOURCE_FILTER_H_ |