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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/Array.h

Issue 1758313002: DevTools: introduce collections shim to be backed by non-wtf in v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing Created 4 years, 9 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
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 #ifndef Array_h 5 #ifndef Array_h
6 #define Array_h 6 #define Array_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/inspector_protocol/Collections.h"
9 #include "platform/inspector_protocol/ErrorSupport.h" 10 #include "platform/inspector_protocol/ErrorSupport.h"
10 #include "platform/inspector_protocol/ValueConversions.h" 11 #include "platform/inspector_protocol/ValueConversions.h"
11 #include "platform/inspector_protocol/Values.h" 12 #include "platform/inspector_protocol/Values.h"
12 #include "wtf/Vector.h"
13 #include "wtf/text/WTFString.h" 13 #include "wtf/text/WTFString.h"
14 14
15 namespace blink { 15 namespace blink {
16 namespace protocol { 16 namespace protocol {
17 17
18 template<typename T> 18 template<typename T>
19 class ArrayBase { 19 class ArrayBase {
20 public: 20 public:
21 static PassOwnPtr<Array<T>> create() 21 static PassOwnPtr<Array<T>> create()
22 { 22 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 PassOwnPtr<protocol::ListValue> serialize() 61 PassOwnPtr<protocol::ListValue> serialize()
62 { 62 {
63 OwnPtr<protocol::ListValue> result = ListValue::create(); 63 OwnPtr<protocol::ListValue> result = ListValue::create();
64 for (auto& item : m_vector) 64 for (auto& item : m_vector)
65 result->pushValue(toValue(item)); 65 result->pushValue(toValue(item));
66 return result.release(); 66 return result.release();
67 } 67 }
68 68
69 private: 69 private:
70 Vector<T> m_vector; 70 protocol::Vector<T> m_vector;
71 }; 71 };
72 72
73 template<> class Array<String> : public ArrayBase<String> {}; 73 template<> class Array<String> : public ArrayBase<String> {};
74 template<> class Array<int> : public ArrayBase<int> {}; 74 template<> class Array<int> : public ArrayBase<int> {};
75 template<> class Array<double> : public ArrayBase<double> {}; 75 template<> class Array<double> : public ArrayBase<double> {};
76 template<> class Array<bool> : public ArrayBase<bool> {}; 76 template<> class Array<bool> : public ArrayBase<bool> {};
77 77
78 template<typename T> 78 template<typename T>
79 class Array { 79 class Array {
80 public: 80 public:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 PassOwnPtr<protocol::ListValue> serialize() 119 PassOwnPtr<protocol::ListValue> serialize()
120 { 120 {
121 OwnPtr<protocol::ListValue> result = ListValue::create(); 121 OwnPtr<protocol::ListValue> result = ListValue::create();
122 for (auto& item : m_vector) 122 for (auto& item : m_vector)
123 result->pushValue(toValue(item.get())); 123 result->pushValue(toValue(item.get()));
124 return result.release(); 124 return result.release();
125 } 125 }
126 126
127 private: 127 private:
128 Vector<OwnPtr<T>> m_vector; 128 protocol::Vector<OwnPtr<T>> m_vector;
129 }; 129 };
130 130
131 } // namespace platform 131 } // namespace platform
132 } // namespace blink 132 } // namespace blink
133 133
134 #endif // !defined(Array_h) 134 #endif // !defined(Array_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698