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

Side by Side Diff: content/child/push_messaging/push_dispatcher.h

Issue 2690203003: Convert push_messaging IPC msgs into mojo interfaces (Closed)
Patch Set: code rebase Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/child/push_messaging/push_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 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_PUSH_MESSAGING_PUSH_DISPATCHER_H_
6 #define CONTENT_CHILD_PUSH_MESSAGING_PUSH_DISPATCHER_H_
7
8 #include <map>
9
10 #include "base/macros.h"
11 #include "base/synchronization/lock.h"
12 #include "content/child/worker_thread_message_filter.h"
13
14 namespace content {
15
16 class PushDispatcher : public WorkerThreadMessageFilter {
17 public:
18 explicit PushDispatcher(ThreadSafeSender* thread_safe_sender);
19
20 // Generates a process-unique new request id. Stores it in a map as key to
21 // |thread_id| and returns it. This method can be called on any thread.
22 // Note that the registration requests from document contexts do not go via
23 // this class and their request ids may overlap with the ones generated here.
24 int GenerateRequestId(int thread_id);
25
26 protected:
27 ~PushDispatcher() override;
28
29 private:
30 // WorkerThreadMessageFilter:
31 bool ShouldHandleMessage(const IPC::Message& msg) const override;
32 void OnFilteredMessageReceived(const IPC::Message& msg) override;
33 bool GetWorkerThreadIdForMessage(const IPC::Message& msg,
34 int* ipc_thread_id) override;
35
36 base::Lock request_id_map_lock_;
37 std::map<int, int> request_id_map_; // Maps request id to thread id.
38 int next_request_id_;
39
40 DISALLOW_COPY_AND_ASSIGN(PushDispatcher);
41 };
42
43 } // namespace content
44
45 #endif // CONTENT_CHILD_PUSH_MESSAGING_PUSH_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.cc ('k') | content/child/push_messaging/push_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698