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

Side by Side Diff: mojo/common/values_struct_traits.cc

Issue 2686763002: [Mojo Video Capture] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() and OnFrameReadyInBuffer( (Closed)
Patch Set: rebase 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
« no previous file with comments | « mojo/common/values_struct_traits.h ('k') | mojo/public/cpp/bindings/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "mojo/common/values_struct_traits.h" 6 #include "mojo/common/values_struct_traits.h"
7 7
8 namespace mojo { 8 namespace mojo {
9 9
10 bool StructTraits<common::mojom::ListValueDataView, 10 bool StructTraits<common::mojom::ListValueDataView,
(...skipping 27 matching lines...) Expand all
38 std::unique_ptr<base::Value> value; 38 std::unique_ptr<base::Value> value;
39 if (!view.keys().Read(i, &key) || !view.values().Read(i, &value)) 39 if (!view.keys().Read(i, &key) || !view.values().Read(i, &value))
40 return false; 40 return false;
41 41
42 dictionary_value->SetWithoutPathExpansion(key, std::move(value)); 42 dictionary_value->SetWithoutPathExpansion(key, std::move(value));
43 } 43 }
44 *value_out = std::move(dictionary_value); 44 *value_out = std::move(dictionary_value);
45 return true; 45 return true;
46 } 46 }
47 47
48 std::unique_ptr<base::DictionaryValue>
49 CloneTraits<std::unique_ptr<base::DictionaryValue>, false>::Clone(
50 const std::unique_ptr<base::DictionaryValue>& input) {
51 auto result = base::MakeUnique<base::DictionaryValue>();
52 result->MergeDictionary(input.get());
53 return result;
54 }
55
48 bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>:: 56 bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>::
49 Read(common::mojom::ValueDataView data, 57 Read(common::mojom::ValueDataView data,
50 std::unique_ptr<base::Value>* value_out) { 58 std::unique_ptr<base::Value>* value_out) {
51 switch (data.tag()) { 59 switch (data.tag()) {
52 case common::mojom::ValueDataView::Tag::NULL_VALUE: { 60 case common::mojom::ValueDataView::Tag::NULL_VALUE: {
53 *value_out = base::Value::CreateNullValue(); 61 *value_out = base::Value::CreateNullValue();
54 return true; 62 return true;
55 } 63 }
56 case common::mojom::ValueDataView::Tag::BOOL_VALUE: { 64 case common::mojom::ValueDataView::Tag::BOOL_VALUE: {
57 *value_out = base::MakeUnique<base::FundamentalValue>(data.bool_value()); 65 *value_out = base::MakeUnique<base::FundamentalValue>(data.bool_value());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if (!data.ReadListValue(&list_value)) 101 if (!data.ReadListValue(&list_value))
94 return false; 102 return false;
95 *value_out = std::move(list_value); 103 *value_out = std::move(list_value);
96 return true; 104 return true;
97 } 105 }
98 } 106 }
99 return false; 107 return false;
100 } 108 }
101 109
102 } // namespace mojo 110 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/common/values_struct_traits.h ('k') | mojo/public/cpp/bindings/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698