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

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

Issue 1979953002: Remove OwnPtr::release() calls in modules/ (part 3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 public: 64 public:
65 static PassRefPtr<ExecuteSQLCallbackWrapper> create(PassOwnPtr<ExecuteSQLCal lback> callback) { return adoptRef(new ExecuteSQLCallbackWrapper(std::move(callb ack))); } 65 static PassRefPtr<ExecuteSQLCallbackWrapper> create(PassOwnPtr<ExecuteSQLCal lback> callback) { return adoptRef(new ExecuteSQLCallbackWrapper(std::move(callb ack))); }
66 ~ExecuteSQLCallbackWrapper() { } 66 ~ExecuteSQLCallbackWrapper() { }
67 ExecuteSQLCallback* get() { return m_callback.get(); } 67 ExecuteSQLCallback* get() { return m_callback.get(); }
68 68
69 void reportTransactionFailed(SQLError* error) 69 void reportTransactionFailed(SQLError* error)
70 { 70 {
71 OwnPtr<protocol::Database::Error> errorObject = protocol::Database::Erro r::create() 71 OwnPtr<protocol::Database::Error> errorObject = protocol::Database::Erro r::create()
72 .setMessage(error->message()) 72 .setMessage(error->message())
73 .setCode(error->code()).build(); 73 .setCode(error->code()).build();
74 m_callback->sendSuccess(Maybe<protocol::Array<String>>(), Maybe<protocol ::Array<protocol::Value>>(), errorObject.release()); 74 m_callback->sendSuccess(Maybe<protocol::Array<String>>(), Maybe<protocol ::Array<protocol::Value>>(), std::move(errorObject));
75 } 75 }
76 76
77 private: 77 private:
78 explicit ExecuteSQLCallbackWrapper(PassOwnPtr<ExecuteSQLCallback> callback) : m_callback(std::move(callback)) { } 78 explicit ExecuteSQLCallbackWrapper(PassOwnPtr<ExecuteSQLCallback> callback) : m_callback(std::move(callback)) { }
79 OwnPtr<ExecuteSQLCallback> m_callback; 79 OwnPtr<ExecuteSQLCallback> m_callback;
80 }; 80 };
81 81
82 class StatementCallback final : public SQLStatementCallback { 82 class StatementCallback final : public SQLStatementCallback {
83 public: 83 public:
84 static StatementCallback* create(PassRefPtr<ExecuteSQLCallbackWrapper> reque stCallback) 84 static StatementCallback* create(PassRefPtr<ExecuteSQLCallbackWrapper> reque stCallback)
(...skipping 20 matching lines...) Expand all
105 OwnPtr<protocol::Array<protocol::Value>> values = protocol::Array<protoc ol::Value>::create(); 105 OwnPtr<protocol::Array<protocol::Value>> values = protocol::Array<protoc ol::Value>::create();
106 const Vector<SQLValue>& data = rowList->values(); 106 const Vector<SQLValue>& data = rowList->values();
107 for (size_t i = 0; i < data.size(); ++i) { 107 for (size_t i = 0; i < data.size(); ++i) {
108 const SQLValue& value = rowList->values()[i]; 108 const SQLValue& value = rowList->values()[i];
109 switch (value.getType()) { 109 switch (value.getType()) {
110 case SQLValue::StringValue: values->addItem(protocol::StringValue::c reate(value.string())); break; 110 case SQLValue::StringValue: values->addItem(protocol::StringValue::c reate(value.string())); break;
111 case SQLValue::NumberValue: values->addItem(protocol::FundamentalVal ue::create(value.number())); break; 111 case SQLValue::NumberValue: values->addItem(protocol::FundamentalVal ue::create(value.number())); break;
112 case SQLValue::NullValue: values->addItem(protocol::Value::null()); break; 112 case SQLValue::NullValue: values->addItem(protocol::Value::null()); break;
113 } 113 }
114 } 114 }
115 m_requestCallback->get()->sendSuccess(columnNames.release(), values.rele ase(), Maybe<protocol::Database::Error>()); 115 m_requestCallback->get()->sendSuccess(std::move(columnNames), std::move( values), Maybe<protocol::Database::Error>());
116 return true; 116 return true;
117 } 117 }
118 118
119 private: 119 private:
120 StatementCallback(PassRefPtr<ExecuteSQLCallbackWrapper> requestCallback) : m _requestCallback(requestCallback) { } 120 StatementCallback(PassRefPtr<ExecuteSQLCallbackWrapper> requestCallback) : m _requestCallback(requestCallback) { }
121 RefPtr<ExecuteSQLCallbackWrapper> m_requestCallback; 121 RefPtr<ExecuteSQLCallbackWrapper> m_requestCallback;
122 }; 122 };
123 123
124 class StatementErrorCallback final : public SQLStatementErrorCallback { 124 class StatementErrorCallback final : public SQLStatementErrorCallback {
125 public: 125 public:
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 requestCallback->sendFailure("Database agent is not enabled"); 313 requestCallback->sendFailure("Database agent is not enabled");
314 return; 314 return;
315 } 315 }
316 316
317 blink::Database* database = databaseForId(databaseId); 317 blink::Database* database = databaseForId(databaseId);
318 if (!database) { 318 if (!database) {
319 requestCallback->sendFailure("Database not found"); 319 requestCallback->sendFailure("Database not found");
320 return; 320 return;
321 } 321 }
322 322
323 RefPtr<ExecuteSQLCallbackWrapper> wrapper = ExecuteSQLCallbackWrapper::creat e(requestCallback.release()); 323 RefPtr<ExecuteSQLCallbackWrapper> wrapper = ExecuteSQLCallbackWrapper::creat e(std::move(requestCallback));
324 SQLTransactionCallback* callback = TransactionCallback::create(query, wrappe r); 324 SQLTransactionCallback* callback = TransactionCallback::create(query, wrappe r);
325 SQLTransactionErrorCallback* errorCallback = TransactionErrorCallback::creat e(wrapper); 325 SQLTransactionErrorCallback* errorCallback = TransactionErrorCallback::creat e(wrapper);
326 VoidCallback* successCallback = TransactionSuccessCallback::create(); 326 VoidCallback* successCallback = TransactionSuccessCallback::create();
327 database->transaction(callback, errorCallback, successCallback); 327 database->transaction(callback, errorCallback, successCallback);
328 } 328 }
329 329
330 InspectorDatabaseResource* InspectorDatabaseAgent::findByFileName(const String& fileName) 330 InspectorDatabaseResource* InspectorDatabaseAgent::findByFileName(const String& fileName)
331 { 331 {
332 for (DatabaseResourcesHeapMap::iterator it = m_resources.begin(); it != m_re sources.end(); ++it) { 332 for (DatabaseResourcesHeapMap::iterator it = m_resources.begin(); it != m_re sources.end(); ++it) {
333 if (it->value->database()->fileName() == fileName) 333 if (it->value->database()->fileName() == fileName)
(...skipping 11 matching lines...) Expand all
345 } 345 }
346 346
347 DEFINE_TRACE(InspectorDatabaseAgent) 347 DEFINE_TRACE(InspectorDatabaseAgent)
348 { 348 {
349 visitor->trace(m_page); 349 visitor->trace(m_page);
350 visitor->trace(m_resources); 350 visitor->trace(m_resources);
351 InspectorBaseAgent::trace(visitor); 351 InspectorBaseAgent::trace(visitor);
352 } 352 }
353 353
354 } // namespace blink 354 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698