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

Side by Side Diff: content/browser/android/java/gin_java_bridge_message_filter.h

Issue 1547043002: [Android] Fix GinJavaBridgeMessageFilter registration issue in Java Bridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
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 <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 25 matching lines...) Expand all
36 const IPC::Message& message) override; 36 const IPC::Message& message) override;
37 37
38 // Called on the UI thread. 38 // Called on the UI thread.
39 void AddRoutingIdForHost(GinJavaBridgeDispatcherHost* host, 39 void AddRoutingIdForHost(GinJavaBridgeDispatcherHost* host,
40 RenderFrameHost* render_frame_host); 40 RenderFrameHost* render_frame_host);
41 void RemoveHost(GinJavaBridgeDispatcherHost* host); 41 void RemoveHost(GinJavaBridgeDispatcherHost* host);
42 42
43 static scoped_refptr<GinJavaBridgeMessageFilter> FromHost( 43 static scoped_refptr<GinJavaBridgeMessageFilter> FromHost(
44 GinJavaBridgeDispatcherHost* host, bool create_if_not_exists); 44 GinJavaBridgeDispatcherHost* host, bool create_if_not_exists);
45 45
46 void SetNeedsToAddFilterForNewIpcChannel(bool add_filter) {
47 needs_to_add_filter_for_new_ipc_channel_ = add_filter;
48 }
49
50 bool NeedsToAddFilterForNewIpcChannel() {
51 return needs_to_add_filter_for_new_ipc_channel_;
52 }
53
46 private: 54 private:
47 friend class BrowserThread; 55 friend class BrowserThread;
48 friend class base::DeleteHelper<GinJavaBridgeMessageFilter>; 56 friend class base::DeleteHelper<GinJavaBridgeMessageFilter>;
49 57
50 // ContentViewCore (who owns GinJavaBridgeDispatcherHost) outlives 58 // ContentViewCore (who owns GinJavaBridgeDispatcherHost) outlives
51 // WebContents, and GinJavaBridgeDispatcherHost removes itself from the map on 59 // WebContents, and GinJavaBridgeDispatcherHost removes itself from the map on
52 // WebContents destruction, so there is no risk that the pointer would become 60 // WebContents destruction, so there is no risk that the pointer would become
53 // stale. 61 // stale.
54 // 62 //
55 // The filter keeps its own routing map of RenderFrames for two reasons: 63 // The filter keeps its own routing map of RenderFrames for two reasons:
(...skipping 22 matching lines...) Expand all
78 content::GinJavaBridgeError* error_code); 86 content::GinJavaBridgeError* error_code);
79 void OnObjectWrapperDeleted(GinJavaBoundObject::ObjectID object_id); 87 void OnObjectWrapperDeleted(GinJavaBoundObject::ObjectID object_id);
80 88
81 // Accessed both from UI and background threads. 89 // Accessed both from UI and background threads.
82 HostMap hosts_; 90 HostMap hosts_;
83 base::Lock hosts_lock_; 91 base::Lock hosts_lock_;
84 92
85 // The routing id of the RenderFrameHost whose request we are processing. 93 // The routing id of the RenderFrameHost whose request we are processing.
86 // Used on the background thread. 94 // Used on the background thread.
87 int32 current_routing_id_; 95 int32 current_routing_id_;
96
97 // Communication channel between RPH and sandbox render process has exited. It
98 // needs to re-register the message filter with the newly created channel to
99 // receive Java bridge messages from renderer.
100 bool needs_to_add_filter_for_new_ipc_channel_;
88 }; 101 };
89 102
90 } // namespace content 103 } // namespace content
91 104
92 #endif // CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_ 105 #endif // CONTENT_BROWSER_ANDROID_JAVA_GIN_JAVA_BRIDGE_MESSAGE_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698