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

Unified Diff: content/child/resource_scheduling_filter.h

Issue 1366883002: [Reland] Post loading tasks on the appropriate WebFrameScheduler's queue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix UAF in BackgroundHTMLParser Created 5 years, 2 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
Index: content/child/resource_scheduling_filter.h
diff --git a/content/child/resource_scheduling_filter.h b/content/child/resource_scheduling_filter.h
index 7ea73c90724d57e238e1950a225f3a90d1a207f4..fd24559229a0f2ea5933bc7c7083aefe39692bdb 100644
--- a/content/child/resource_scheduling_filter.h
+++ b/content/child/resource_scheduling_filter.h
@@ -5,12 +5,19 @@
#ifndef CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_
#define CONTENT_CHILD_RESOURCE_SCHEDULING_FILTER_H_
+#include <map>
+
#include "base/containers/hash_tables.h"
+#include "base/containers/scoped_ptr_map.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "content/common/content_export.h"
#include "ipc/message_filter.h"
+namespace blink {
+class WebTaskRunner;
+}
+
namespace content {
class ResourceDispatcher;
@@ -28,11 +35,25 @@ class CONTENT_EXPORT ResourceSchedulingFilter : public IPC::MessageFilter {
bool GetSupportedMessageClasses(
std::vector<uint32>* supported_message_classes) const override;
- protected:
- ~ResourceSchedulingFilter() override;
+ // Sets the task runner associated with request messages with |id|.
+ void SetRequestIdTaskRunner(
+ int id, scoped_ptr<blink::WebTaskRunner> web_task_runner);
+
+ // Removes the task runner associated with |id|.
+ void ClearRequestIdTaskRunner(int id);
void DispatchMessage(const IPC::Message& message);
+ private:
+ ~ResourceSchedulingFilter() override;
+
+ typedef base::ScopedPtrMap<int, scoped_ptr<blink::WebTaskRunner>>
+ RequestIdToTaskRunnerMap;
+
+ // This lock guards |request_id_to_task_runner_map_|
+ base::Lock request_id_to_task_runner_map_lock_;
+ RequestIdToTaskRunnerMap request_id_to_task_runner_map_;
+
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
ResourceDispatcher* resource_dispatcher_; // NOT OWNED
base::WeakPtrFactory<ResourceSchedulingFilter> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698