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

Side by Side Diff: content/public/common/message_port_message.cc

Issue 921013002: Optionally have MessagePort pass data as base::Value, part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-move-v8-value-converter
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/public/common/message_port_message.h"
6
7 namespace content {
8
9 MessagePortMessage::MessagePortMessage() {
10 }
11
12 MessagePortMessage::MessagePortMessage(const base::string16& message)
13 : message_as_string(message) {
14 }
15
16 MessagePortMessage::MessagePortMessage(const base::Value* message) {
17 message_as_value.Append(message->DeepCopy());
18 }
19
20 MessagePortMessage::MessagePortMessage(const MessagePortMessage& other) {
21 *this = other;
22 }
23
24 MessagePortMessage& MessagePortMessage::operator=(
25 const MessagePortMessage& other) {
26 message_as_string = other.message_as_string;
27 message_as_value.Clear();
28 const base::Value* value;
29 if (other.message_as_value.Get(0, &value))
30 message_as_value.Append(value->DeepCopy());
31 return *this;
32 }
33
34 MessagePortMessage::~MessagePortMessage() {
35 }
36
37 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698