Update V8 to version 4.5.107.
[chromium-blink-merge.git] / content / child / resource_scheduling_filter.h
blob7ea73c90724d57e238e1950a225f3a90d1a207f4
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.
5 #ifndef CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_
6 #define CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_
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"
14 namespace content {
15 class ResourceDispatcher;
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);
25 // IPC::MessageFilter overrides:
26 bool OnMessageReceived(const IPC::Message& message) override;
28 bool GetSupportedMessageClasses(
29 std::vector<uint32>* supported_message_classes) const override;
31 protected:
32 ~ResourceSchedulingFilter() override;
34 void DispatchMessage(const IPC::Message& message);
36 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
37 ResourceDispatcher* resource_dispatcher_; // NOT OWNED
38 base::WeakPtrFactory<ResourceSchedulingFilter> weak_ptr_factory_;
40 private:
41 DISALLOW_COPY_AND_ASSIGN(ResourceSchedulingFilter);
44 } // namespace content
46 #endif // CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_