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

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

Issue 1779033003: DevTools: always use 16bit strings for inspector protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined 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/Collections.h"
10 #include "platform/inspector_protocol/ErrorSupport.h" 10 #include "platform/inspector_protocol/ErrorSupport.h"
(...skipping 15 matching lines...) Expand all
26 static PassOwnPtr<Array<T>> parse(protocol::Value* value, ErrorSupport* erro rs) 26 static PassOwnPtr<Array<T>> parse(protocol::Value* value, ErrorSupport* erro rs)
27 { 27 {
28 protocol::ListValue* array = ListValue::cast(value); 28 protocol::ListValue* array = ListValue::cast(value);
29 if (!array) { 29 if (!array) {
30 errors->addError("array expected"); 30 errors->addError("array expected");
31 return nullptr; 31 return nullptr;
32 } 32 }
33 errors->push(); 33 errors->push();
34 OwnPtr<Array<T>> result = adoptPtr(new Array<T>()); 34 OwnPtr<Array<T>> result = adoptPtr(new Array<T>());
35 for (size_t i = 0; i < array->size(); ++i) { 35 for (size_t i = 0; i < array->size(); ++i) {
36 errors->setName("[" + String16::number(i) + "]"); 36 errors->setName(String16::number(i));
37 T item = FromValue<T>::parse(array->at(i), errors); 37 T item = FromValue<T>::parse(array->at(i), errors);
38 result->m_vector.append(item); 38 result->m_vector.append(item);
39 } 39 }
40 errors->pop(); 40 errors->pop();
41 if (errors->hasErrors()) 41 if (errors->hasErrors())
42 return nullptr; 42 return nullptr;
43 return result.release(); 43 return result.release();
44 } 44 }
45 45
46 void addItem(const T& value) 46 void addItem(const T& value)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 static PassOwnPtr<Array<T>> parse(protocol::Value* value, ErrorSupport* erro rs) 87 static PassOwnPtr<Array<T>> parse(protocol::Value* value, ErrorSupport* erro rs)
88 { 88 {
89 protocol::ListValue* array = ListValue::cast(value); 89 protocol::ListValue* array = ListValue::cast(value);
90 if (!array) { 90 if (!array) {
91 errors->addError("array expected"); 91 errors->addError("array expected");
92 return nullptr; 92 return nullptr;
93 } 93 }
94 OwnPtr<Array<T>> result = adoptPtr(new Array<T>()); 94 OwnPtr<Array<T>> result = adoptPtr(new Array<T>());
95 errors->push(); 95 errors->push();
96 for (size_t i = 0; i < array->size(); ++i) { 96 for (size_t i = 0; i < array->size(); ++i) {
97 errors->setName("[" + String16::number(i) + "]"); 97 errors->setName(String16::number(i));
98 OwnPtr<T> item = FromValue<T>::parse(array->at(i), errors); 98 OwnPtr<T> item = FromValue<T>::parse(array->at(i), errors);
99 result->m_vector.append(item.release()); 99 result->m_vector.append(item.release());
100 } 100 }
101 errors->pop(); 101 errors->pop();
102 return result.release(); 102 return result.release();
103 } 103 }
104 104
105 void addItem(PassOwnPtr<T> value) 105 void addItem(PassOwnPtr<T> value)
106 { 106 {
107 m_vector.append(value); 107 m_vector.append(value);
(...skipping 18 matching lines...) Expand all
126 } 126 }
127 127
128 private: 128 private:
129 protocol::Vector<OwnPtr<T>> m_vector; 129 protocol::Vector<OwnPtr<T>> m_vector;
130 }; 130 };
131 131
132 } // namespace platform 132 } // namespace platform
133 } // namespace blink 133 } // namespace blink
134 134
135 #endif // !defined(Array_h) 135 #endif // !defined(Array_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698