cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / content / child / quota_message_filter.h
blobd613584920116ba354bfac7852a9b94da07665fe
1 // Copyright 2013 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_QUOTA_MESSAGE_FILTER_H_
6 #define CONTENT_CHILD_QUOTA_MESSAGE_FILTER_H_
8 #include <map>
10 #include "base/synchronization/lock.h"
11 #include "content/child/worker_thread_message_filter.h"
13 namespace content {
15 class QuotaMessageFilter : public WorkerThreadMessageFilter {
16 public:
17 explicit QuotaMessageFilter(ThreadSafeSender* thread_safe_sender);
19 // Generates a new request_id, registers { request_id, thread_id } map to
20 // the message filter and returns the request_id.
21 // This method can be called on any thread.
22 int GenerateRequestID(int thread_id);
24 // Clears all requests from the thread_id.
25 void ClearThreadRequests(int thread_id);
27 protected:
28 ~QuotaMessageFilter() override;
30 private:
31 // WorkerThreadMessageFilter:
32 bool ShouldHandleMessage(const IPC::Message& msg) const override;
33 void OnFilteredMessageReceived(const IPC::Message& msg) override;
34 bool GetWorkerThreadIdForMessage(const IPC::Message& msg,
35 int* ipc_thread_id) override;
37 typedef std::map<int, int> RequestIdToThreadId;
39 base::Lock request_id_map_lock_;
40 RequestIdToThreadId request_id_map_;
41 int next_request_id_;
43 DISALLOW_COPY_AND_ASSIGN(QuotaMessageFilter);
46 } // namespace content
48 #endif // CONTENT_CHILD_QUOTA_MESSAGE_FILTER_H_