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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/ErrorSupport_cpp.template

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile Created 4 years, 3 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 namespace blink { 5 //#include "ErrorSupport.h"
6 namespace protocol { 6
7 {% for namespace in config.protocol.namespace %}
8 namespace {{namespace}} {
9 {% endfor %}
7 10
8 ErrorSupport::ErrorSupport() : m_errorString(nullptr) { } 11 ErrorSupport::ErrorSupport() : m_errorString(nullptr) { }
9 ErrorSupport::ErrorSupport(String16* errorString) : m_errorString(errorString) { } 12 ErrorSupport::ErrorSupport(String* errorString) : m_errorString(errorString) { }
10 ErrorSupport::~ErrorSupport() 13 ErrorSupport::~ErrorSupport()
11 { 14 {
12 if (m_errorString && hasErrors()) { 15 if (m_errorString && hasErrors()) {
13 String16Builder builder; 16 StringBuilder builder;
14 builder.append("Internal error(s): "); 17 builder.append("Internal error(s): ");
15 builder.append(errors()); 18 builder.append(errors());
16 *m_errorString = builder.toString(); 19 *m_errorString = builder.toString();
17 } 20 }
18 } 21 }
19 22
20 void ErrorSupport::setName(const String16& name) 23 void ErrorSupport::setName(const String& name)
21 { 24 {
22 DCHECK(m_path.size()); 25 DCHECK(m_path.size());
23 m_path[m_path.size() - 1] = name; 26 m_path[m_path.size() - 1] = name;
24 } 27 }
25 28
26 void ErrorSupport::push() 29 void ErrorSupport::push()
27 { 30 {
28 m_path.push_back(String16()); 31 m_path.push_back(String());
29 } 32 }
30 33
31 void ErrorSupport::pop() 34 void ErrorSupport::pop()
32 { 35 {
33 m_path.pop_back(); 36 m_path.pop_back();
34 } 37 }
35 38
36 void ErrorSupport::addError(const String16& error) 39 void ErrorSupport::addError(const String& error)
37 { 40 {
38 String16Builder builder; 41 StringBuilder builder;
39 for (size_t i = 0; i < m_path.size(); ++i) { 42 for (size_t i = 0; i < m_path.size(); ++i) {
40 if (i) 43 if (i)
41 builder.append('.'); 44 builder.append('.');
42 builder.append(m_path[i]); 45 builder.append(m_path[i]);
43 } 46 }
44 builder.append(": "); 47 builder.append(": ");
45 builder.append(error); 48 builder.append(error);
46 m_errors.push_back(builder.toString()); 49 m_errors.push_back(builder.toString());
47 } 50 }
48 51
49 bool ErrorSupport::hasErrors() 52 bool ErrorSupport::hasErrors()
50 { 53 {
51 return m_errors.size(); 54 return m_errors.size();
52 } 55 }
53 56
54 String16 ErrorSupport::errors() 57 String ErrorSupport::errors()
55 { 58 {
56 String16Builder builder; 59 StringBuilder builder;
57 for (size_t i = 0; i < m_errors.size(); ++i) { 60 for (size_t i = 0; i < m_errors.size(); ++i) {
58 if (i) 61 if (i)
59 builder.append("; "); 62 builder.append("; ");
60 builder.append(m_errors[i]); 63 builder.append(m_errors[i]);
61 } 64 }
62 return builder.toString(); 65 return builder.toString();
63 } 66 }
64 67
65 } // namespace protocol 68 {% for namespace in config.protocol.namespace %}
66 } // namespace blink 69 } // namespace {{namespace}}
70 {% endfor %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698