| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 const IPC::Message& message) override; | 38 const IPC::Message& message) override; |
| 39 | 39 |
| 40 // Called on the UI thread. | 40 // Called on the UI thread. |
| 41 void AddRoutingIdForHost(GinJavaBridgeDispatcherHost* host, | 41 void AddRoutingIdForHost(GinJavaBridgeDispatcherHost* host, |
| 42 RenderFrameHost* render_frame_host); | 42 RenderFrameHost* render_frame_host); |
| 43 void RemoveHost(GinJavaBridgeDispatcherHost* host); | 43 void RemoveHost(GinJavaBridgeDispatcherHost* host); |
| 44 | 44 |
| 45 static scoped_refptr<GinJavaBridgeMessageFilter> FromHost( | 45 static scoped_refptr<GinJavaBridgeMessageFilter> FromHost( |
| 46 GinJavaBridgeDispatcherHost* host, bool create_if_not_exists); | 46 GinJavaBridgeDispatcherHost* host, bool create_if_not_exists); |
| 47 | 47 |
| 48 // Removes the filter, which triggers its deletion. Needs to be called when |
| 49 // the corresponding RenderProcessHost cleans itself up, e.g. on renderer |
| 50 // process exit. |
| 51 static void RemoveFilter(GinJavaBridgeDispatcherHost* host); |
| 52 |
| 48 private: | 53 private: |
| 49 friend class BrowserThread; | 54 friend class BrowserThread; |
| 50 friend class base::DeleteHelper<GinJavaBridgeMessageFilter>; | 55 friend class base::DeleteHelper<GinJavaBridgeMessageFilter>; |
| 51 | 56 |
| 52 // ContentViewCore (who owns GinJavaBridgeDispatcherHost) outlives | 57 // ContentViewCore (who owns GinJavaBridgeDispatcherHost) outlives |
| 53 // WebContents, and GinJavaBridgeDispatcherHost removes itself from the map on | 58 // WebContents, and GinJavaBridgeDispatcherHost removes itself from the map on |
| 54 // WebContents destruction, so there is no risk that the pointer would become | 59 // WebContents destruction, so there is no risk that the pointer would become |
| 55 // stale. | 60 // stale. |
| 56 // | 61 // |
| 57 // The filter keeps its own routing map of RenderFrames for two reasons: | 62 // The filter keeps its own routing map of RenderFrames for two reasons: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 base::Lock hosts_lock_; | 90 base::Lock hosts_lock_; |
| 86 | 91 |
| 87 // The routing id of the RenderFrameHost whose request we are processing. | 92 // The routing id of the RenderFrameHost whose request we are processing. |
| 88 // Used on the background thread. | 93 // Used on the background thread. |
| 89 int32_t current_routing_id_; | 94 int32_t current_routing_id_; |
| 90 }; | 95 }; |
| 91 | 96 |
| 92 } // namespace content | 97 } // namespace content |
| 93 | 98 |
| 94 #endif // CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ | 99 #endif // CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ |
| OLD | NEW |