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

Side by Side Diff: content/browser/android/string_message_codec.h

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Address feedback from Selim 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
OLDNEW
(Empty)
1 // Copyright 2017 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_BROWSER_ANDROID_STRING_MESSAGE_CODEC_H_
6 #define CONTENT_BROWSER_ANDROID_STRING_MESSAGE_CODEC_H_
7
8 #include "base/strings/string16.h"
9 #include "content/common/content_export.h"
10
11 namespace content {
12
13 // To support exposing HTML message ports to Java, it is necessary to be able
14 // encode and decode message data using the same serialization format as V8.
kinuko 2017/02/09 06:21:30 nit: to be able encode -> to be able to encode
15 // That format is an implementation detail of V8, but we cannot invoke V8 in
16 // the browser process. Rather than IPC over to the renderer process to execute
17 // the V8 serialization code, we duplicate some of the serialization logic
18 // (just for simple string messages) here. This is a trade-off between overall
19 // complexity / performance and code duplication. Fortunately, we only need to
20 // handle string messages and this serialization format is static, as it is a
21 // format we currently persist to disk via IndexedDB.
22
23 CONTENT_EXPORT base::string16 EncodeStringMessage(const base::string16& data);
24
25 CONTENT_EXPORT bool DecodeStringMessage(const base::string16& encoded_data,
26 base::string16* result);
27
28 } // namespace content
29
30 #endif // CONTENT_BROWSER_ANDROID_STRING_MESSAGE_CODEC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698