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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.cpp

Issue 1730383003: DevTools: consistently use Maybe for optional values in the protocol generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static const char databaseAgentEnabled[] = "databaseAgentEnabled"; 56 static const char databaseAgentEnabled[] = "databaseAgentEnabled";
57 }; 57 };
58 58
59 namespace { 59 namespace {
60 60
61 void reportTransactionFailed(ExecuteSQLCallback* requestCallback, SQLError* erro r) 61 void reportTransactionFailed(ExecuteSQLCallback* requestCallback, SQLError* erro r)
62 { 62 {
63 OwnPtr<protocol::Database::Error> errorObject = protocol::Database::Error::c reate() 63 OwnPtr<protocol::Database::Error> errorObject = protocol::Database::Error::c reate()
64 .setMessage(error->message()) 64 .setMessage(error->message())
65 .setCode(error->code()).build(); 65 .setCode(error->code()).build();
66 requestCallback->sendSuccess(nullptr, nullptr, errorObject.release()); 66 requestCallback->sendSuccess(Maybe<protocol::Array<String>>(), Maybe<protoco l::Array<RefPtr<JSONValue>>>(), errorObject.release());
67 } 67 }
68 68
69 class StatementCallback final : public SQLStatementCallback { 69 class StatementCallback final : public SQLStatementCallback {
70 public: 70 public:
71 static StatementCallback* create(PassRefPtr<ExecuteSQLCallback> requestCallb ack) 71 static StatementCallback* create(PassRefPtr<ExecuteSQLCallback> requestCallb ack)
72 { 72 {
73 return new StatementCallback(requestCallback); 73 return new StatementCallback(requestCallback);
74 } 74 }
75 75
76 ~StatementCallback() override { } 76 ~StatementCallback() override { }
(...skipping 15 matching lines...) Expand all
92 OwnPtr<protocol::Array<RefPtr<JSONValue>>> values = protocol::Array<RefP tr<JSONValue>>::create(); 92 OwnPtr<protocol::Array<RefPtr<JSONValue>>> values = protocol::Array<RefP tr<JSONValue>>::create();
93 const Vector<SQLValue>& data = rowList->values(); 93 const Vector<SQLValue>& data = rowList->values();
94 for (size_t i = 0; i < data.size(); ++i) { 94 for (size_t i = 0; i < data.size(); ++i) {
95 const SQLValue& value = rowList->values()[i]; 95 const SQLValue& value = rowList->values()[i];
96 switch (value.type()) { 96 switch (value.type()) {
97 case SQLValue::StringValue: values->addItem(JSONString::create(value .string())); break; 97 case SQLValue::StringValue: values->addItem(JSONString::create(value .string())); break;
98 case SQLValue::NumberValue: values->addItem(JSONBasicValue::create(v alue.number())); break; 98 case SQLValue::NumberValue: values->addItem(JSONBasicValue::create(v alue.number())); break;
99 case SQLValue::NullValue: values->addItem(JSONValue::null()); break; 99 case SQLValue::NullValue: values->addItem(JSONValue::null()); break;
100 } 100 }
101 } 101 }
102 m_requestCallback->sendSuccess(columnNames.release(), values.release(), nullptr); 102 m_requestCallback->sendSuccess(columnNames.release(), values.release(), Maybe<protocol::Database::Error>());
103 return true; 103 return true;
104 } 104 }
105 105
106 private: 106 private:
107 StatementCallback(PassRefPtr<ExecuteSQLCallback> requestCallback) 107 StatementCallback(PassRefPtr<ExecuteSQLCallback> requestCallback)
108 : m_requestCallback(requestCallback) { } 108 : m_requestCallback(requestCallback) { }
109 RefPtr<ExecuteSQLCallback> m_requestCallback; 109 RefPtr<ExecuteSQLCallback> m_requestCallback;
110 }; 110 };
111 111
112 class StatementErrorCallback final : public SQLStatementErrorCallback { 112 class StatementErrorCallback final : public SQLStatementErrorCallback {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 328
329 DEFINE_TRACE(InspectorDatabaseAgent) 329 DEFINE_TRACE(InspectorDatabaseAgent)
330 { 330 {
331 visitor->trace(m_page); 331 visitor->trace(m_page);
332 visitor->trace(m_resources); 332 visitor->trace(m_resources);
333 InspectorBaseAgent::trace(visitor); 333 InspectorBaseAgent::trace(visitor);
334 } 334 }
335 335
336 } // namespace blink 336 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698