OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_MESSAGE_PORT_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // Filter for MessagePort related IPC messages (creating and destroying a | 14 // Filter for MessagePort related IPC messages (creating and destroying a |
15 // MessagePort, sending a message via a MessagePort etc). | 15 // MessagePort, sending a message via a MessagePort etc). |
16 class CONTENT_EXPORT MessagePortMessageFilter : public BrowserMessageFilter { | 16 class CONTENT_EXPORT MessagePortMessageFilter : public BrowserMessageFilter { |
17 public: | 17 public: |
18 typedef base::Callback<int(void)> NextRoutingIDCallback; | 18 typedef base::Callback<int(void)> NextRoutingIDCallback; |
19 | 19 |
20 // |next_routing_id| is owned by this object. It can be used up until | 20 // |next_routing_id| is owned by this object. It can be used up until |
21 // OnChannelClosing. | 21 // OnChannelClosing. |
22 explicit MessagePortMessageFilter(const NextRoutingIDCallback& callback); | 22 explicit MessagePortMessageFilter(const NextRoutingIDCallback& callback); |
23 | 23 |
24 // BrowserMessageFilter implementation. | 24 // BrowserMessageFilter implementation. |
25 virtual void OnChannelClosing() OVERRIDE; | 25 virtual void OnChannelClosing() override; |
26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 26 virtual bool OnMessageReceived(const IPC::Message& message) override; |
27 virtual void OnDestruct() const OVERRIDE; | 27 virtual void OnDestruct() const override; |
28 | 28 |
29 int GetNextRoutingID(); | 29 int GetNextRoutingID(); |
30 | 30 |
31 // Updates message ports registered for |message_port_ids| and returns | 31 // Updates message ports registered for |message_port_ids| and returns |
32 // new routing IDs for the updated ports via |new_routing_ids|. | 32 // new routing IDs for the updated ports via |new_routing_ids|. |
33 void UpdateMessagePortsWithNewRoutes( | 33 void UpdateMessagePortsWithNewRoutes( |
34 const std::vector<int>& message_port_ids, | 34 const std::vector<int>& message_port_ids, |
35 std::vector<int>* new_routing_ids); | 35 std::vector<int>* new_routing_ids); |
36 | 36 |
37 protected: | 37 protected: |
(...skipping 10 matching lines...) Expand all Loading... |
48 // This is guaranteed to be valid until OnChannelClosing is invoked, and it's | 48 // This is guaranteed to be valid until OnChannelClosing is invoked, and it's |
49 // not used after. | 49 // not used after. |
50 NextRoutingIDCallback next_routing_id_; | 50 NextRoutingIDCallback next_routing_id_; |
51 | 51 |
52 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortMessageFilter); | 52 DISALLOW_IMPLICIT_CONSTRUCTORS(MessagePortMessageFilter); |
53 }; | 53 }; |
54 | 54 |
55 } // namespace content | 55 } // namespace content |
56 | 56 |
57 #endif // CONTENT_BROWSER_WORKER_MESSAGE_FILTER_H_ | 57 #endif // CONTENT_BROWSER_WORKER_MESSAGE_FILTER_H_ |
OLD | NEW |