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

Side by Side Diff: android_webview/native/aw_message_port_service_impl.h

Issue 956763002: Implement the close() API for Message ports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Nasko review Created 5 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
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 ANDROID_WEBVIEW_NATIVE_AW_MESSAGE_PORT_SERVICE_IMPL_H_ 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_MESSAGE_PORT_SERVICE_IMPL_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_MESSAGE_PORT_SERVICE_IMPL_H_ 6 #define ANDROID_WEBVIEW_NATIVE_AW_MESSAGE_PORT_SERVICE_IMPL_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 10
(...skipping 21 matching lines...) Expand all
32 void CreateMessageChannel(JNIEnv* env, jobjectArray ports, 32 void CreateMessageChannel(JNIEnv* env, jobjectArray ports,
33 scoped_refptr<AwMessagePortMessageFilter> filter); 33 scoped_refptr<AwMessagePortMessageFilter> filter);
34 34
35 // AwMessagePortService implementation 35 // AwMessagePortService implementation
36 void OnConvertedWebToAppMessage( 36 void OnConvertedWebToAppMessage(
37 int message_port_id, 37 int message_port_id,
38 const base::ListValue& message, 38 const base::ListValue& message,
39 const std::vector<int>& sent_message_port_ids) override; 39 const std::vector<int>& sent_message_port_ids) override;
40 void OnMessagePortMessageFilterClosing( 40 void OnMessagePortMessageFilterClosing(
41 AwMessagePortMessageFilter* filter) override; 41 AwMessagePortMessageFilter* filter) override;
42 void CleanupPort(int message_port_id) override;
42 43
43 // Methods called from Java. 44 // Methods called from Java.
44 void PostAppToWebMessage(JNIEnv* env, jobject object, int sender_id, 45 void PostAppToWebMessage(JNIEnv* env, jobject object, int sender_id,
45 jstring message, jintArray sent_ports); 46 jstring message, jintArray sent_ports);
47 void ClosePort(JNIEnv* env, jobject object, int message_port_id);
46 48
47 void RemoveSentPorts(const std::vector<int>& sent_ports); 49 void RemoveSentPorts(const std::vector<int>& sent_ports);
48 50
49 private: 51 private:
50 void PostAppToWebMessageOnIOThread( 52 void PostAppToWebMessageOnIOThread(
51 int sender_id, 53 int sender_id,
52 base::string16* message, 54 base::string16* message,
53 std::vector<int>* sent_ports); 55 std::vector<int>* sent_ports);
54 void CreateMessageChannelOnIOThread( 56 void CreateMessageChannelOnIOThread(
55 scoped_refptr<AwMessagePortMessageFilter> filter, 57 scoped_refptr<AwMessagePortMessageFilter> filter,
56 int* port1, 58 int* port1,
57 int* port2); 59 int* port2);
58 void OnMessageChannelCreated( 60 void OnMessageChannelCreated(
59 base::android::ScopedJavaGlobalRef<jobjectArray>* ports, 61 base::android::ScopedJavaGlobalRef<jobjectArray>* ports,
60 int* port1, 62 int* port1,
61 int* port2); 63 int* port2);
62 void AddPort(int message_port_id, AwMessagePortMessageFilter* filter); 64 void AddPort(int message_port_id, AwMessagePortMessageFilter* filter);
65 void PostClosePortMessage(int message_port_id);
63 66
64 JavaObjectWeakGlobalRef java_ref_; 67 JavaObjectWeakGlobalRef java_ref_;
65 typedef std::map<int, AwMessagePortMessageFilter*> MessagePorts; 68 typedef std::map<int, AwMessagePortMessageFilter*> MessagePorts;
66 MessagePorts ports_; // Access on IO thread 69 MessagePorts ports_; // Access on IO thread
67 70
68 DISALLOW_COPY_AND_ASSIGN(AwMessagePortServiceImpl); 71 DISALLOW_COPY_AND_ASSIGN(AwMessagePortServiceImpl);
69 }; 72 };
70 73
71 bool RegisterAwMessagePortService(JNIEnv* env); 74 bool RegisterAwMessagePortService(JNIEnv* env);
72 75
73 } // namespace android_webview 76 } // namespace android_webview
74 77
75 #endif // ANDROID_WEBVIEW_NATIVE_AW_MESSAGE_PORT_SERVICE_IMPL_H_ 78 #endif // ANDROID_WEBVIEW_NATIVE_AW_MESSAGE_PORT_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698