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

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

Issue 2452853002: [inspector] use own version of third_party/inspector_protocol (Closed)
Patch Set: supported new inspector_protocol location in components/ui_devtools/BUILD.gn Created 4 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 //#include "ErrorSupport.h"
6
7 {% for namespace in config.protocol.namespace %}
8 namespace {{namespace}} {
9 {% endfor %}
10
11 ErrorSupport::ErrorSupport() : m_errorString(nullptr) { }
12 ErrorSupport::ErrorSupport(String* errorString) : m_errorString(errorString) { }
13 ErrorSupport::~ErrorSupport()
14 {
15 if (m_errorString && hasErrors()) {
16 StringBuilder builder;
17 builder.append("Internal error(s): ");
18 builder.append(errors());
19 *m_errorString = builder.toString();
20 }
21 }
22
23 void ErrorSupport::setName(const String& name)
24 {
25 DCHECK(m_path.size());
26 m_path[m_path.size() - 1] = name;
27 }
28
29 void ErrorSupport::push()
30 {
31 m_path.push_back(String());
32 }
33
34 void ErrorSupport::pop()
35 {
36 m_path.pop_back();
37 }
38
39 void ErrorSupport::addError(const String& error)
40 {
41 StringBuilder builder;
42 for (size_t i = 0; i < m_path.size(); ++i) {
43 if (i)
44 builder.append('.');
45 builder.append(m_path[i]);
46 }
47 builder.append(": ");
48 builder.append(error);
49 m_errors.push_back(builder.toString());
50 }
51
52 bool ErrorSupport::hasErrors()
53 {
54 return m_errors.size();
55 }
56
57 String ErrorSupport::errors()
58 {
59 StringBuilder builder;
60 for (size_t i = 0; i < m_errors.size(); ++i) {
61 if (i)
62 builder.append("; ");
63 builder.append(m_errors[i]);
64 }
65 return builder.toString();
66 }
67
68 {% for namespace in config.protocol.namespace %}
69 } // namespace {{namespace}}
70 {% endfor %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698