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

Side by Side Diff: dbus/values_util.cc

Issue 9700072: dbus: add support for passing file descriptors (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: unit test nits Created 8 years, 8 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
« no previous file with comments | « dbus/message_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "dbus/values_util.h" 5 #include "dbus/values_util.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (reader->PopString(&value)) 156 if (reader->PopString(&value))
157 result = Value::CreateStringValue(value); 157 result = Value::CreateStringValue(value);
158 break; 158 break;
159 } 159 }
160 case Message::OBJECT_PATH: { 160 case Message::OBJECT_PATH: {
161 ObjectPath value; 161 ObjectPath value;
162 if (reader->PopObjectPath(&value)) 162 if (reader->PopObjectPath(&value))
163 result = Value::CreateStringValue(value.value()); 163 result = Value::CreateStringValue(value.value());
164 break; 164 break;
165 } 165 }
166 case Message::UNIX_FD: {
167 // Cannot distinguish a file descriptor from an int
168 NOTREACHED();
169 break;
170 }
166 case Message::ARRAY: { 171 case Message::ARRAY: {
167 MessageReader sub_reader(NULL); 172 MessageReader sub_reader(NULL);
168 if (reader->PopArray(&sub_reader)) { 173 if (reader->PopArray(&sub_reader)) {
169 // If the type of the array's element is DICT_ENTRY, create a 174 // If the type of the array's element is DICT_ENTRY, create a
170 // DictionaryValue, otherwise create a ListValue. 175 // DictionaryValue, otherwise create a ListValue.
171 if (sub_reader.GetDataType() == Message::DICT_ENTRY) { 176 if (sub_reader.GetDataType() == Message::DICT_ENTRY) {
172 scoped_ptr<DictionaryValue> dictionary_value(new DictionaryValue); 177 scoped_ptr<DictionaryValue> dictionary_value(new DictionaryValue);
173 if (PopDictionaryEntries(&sub_reader, dictionary_value.get())) 178 if (PopDictionaryEntries(&sub_reader, dictionary_value.get()))
174 result = dictionary_value.release(); 179 result = dictionary_value.release();
175 } else { 180 } else {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 246
242 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer, 247 void AppendBasicTypeValueDataAsVariant(MessageWriter* writer,
243 const base::Value& value) { 248 const base::Value& value) {
244 MessageWriter sub_writer(NULL); 249 MessageWriter sub_writer(NULL);
245 writer->OpenVariant(GetTypeSignature(value), &sub_writer); 250 writer->OpenVariant(GetTypeSignature(value), &sub_writer);
246 AppendBasicTypeValueData(&sub_writer, value); 251 AppendBasicTypeValueData(&sub_writer, value);
247 writer->CloseContainer(&sub_writer); 252 writer->CloseContainer(&sub_writer);
248 } 253 }
249 254
250 } // namespace dbus 255 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/message_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698