OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_ |
| 6 #define CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_ |
| 7 |
| 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 11 #include "content/common/content_export.h" |
| 12 #include "ipc/message_filter.h" |
| 13 |
| 14 namespace content { |
| 15 class ResourceDispatcher; |
| 16 |
| 17 // This filter is used to dispatch resource messages on a specific |
| 18 // SingleThreadTaskRunner to facilitate task scheduling. |
| 19 class CONTENT_EXPORT ResourceSchedulingFilter : public IPC::MessageFilter { |
| 20 public: |
| 21 ResourceSchedulingFilter(const scoped_refptr<base::SingleThreadTaskRunner>& |
| 22 main_thread_task_runner, |
| 23 ResourceDispatcher* resource_dispatcher); |
| 24 |
| 25 virtual bool OnMessageReceived(const IPC::Message& message) override; |
| 26 |
| 27 virtual bool GetSupportedMessageClasses( |
| 28 std::vector<uint32>* supported_message_classes) const override; |
| 29 |
| 30 protected: |
| 31 virtual ~ResourceSchedulingFilter(); |
| 32 |
| 33 void DispatchMessage(const IPC::Message& message); |
| 34 |
| 35 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 36 ResourceDispatcher* resource_dispatcher_; // NOT OWNED |
| 37 base::WeakPtrFactory<ResourceSchedulingFilter> weak_ptr_factory_; |
| 38 }; |
| 39 |
| 40 } // namespace content |
| 41 |
| 42 #endif // CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_ |
OLD | NEW |