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

Unified Diff: content/browser/android/string_message_codec.h

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/android/string_message_codec.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/string_message_codec.h
diff --git a/content/browser/android/string_message_codec.h b/content/browser/android/string_message_codec.h
new file mode 100644
index 0000000000000000000000000000000000000000..94f18c2d596d44b3931bc116a76160aa49d056e3
--- /dev/null
+++ b/content/browser/android/string_message_codec.h
@@ -0,0 +1,30 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ANDROID_STRING_MESSAGE_CODEC_H_
+#define CONTENT_BROWSER_ANDROID_STRING_MESSAGE_CODEC_H_
+
+#include "base/strings/string16.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+// To support exposing HTML message ports to Java, it is necessary to be able
+// to encode and decode message data using the same serialization format as V8.
+// That format is an implementation detail of V8, but we cannot invoke V8 in
+// the browser process. Rather than IPC over to the renderer process to execute
+// the V8 serialization code, we duplicate some of the serialization logic
+// (just for simple string messages) here. This is a trade-off between overall
+// complexity / performance and code duplication. Fortunately, we only need to
+// handle string messages and this serialization format is static, as it is a
+// format we currently persist to disk via IndexedDB.
+
+CONTENT_EXPORT base::string16 EncodeStringMessage(const base::string16& data);
+
+CONTENT_EXPORT bool DecodeStringMessage(const base::string16& encoded_data,
+ base::string16* result);
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_ANDROID_STRING_MESSAGE_CODEC_H_
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/android/string_message_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698