| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * 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 * | 10 * |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/inspector/InspectorInstrumentation.h" | 32 #include "core/inspector/InspectorInstrumentation.h" |
| 33 #include "modules/indexeddb/IDBMetadata.h" | 33 #include "modules/indexeddb/IDBMetadata.h" |
| 34 #include "modules/indexeddb/IDBRequest.h" | 34 #include "modules/indexeddb/IDBRequest.h" |
| 35 #include "modules/indexeddb/IDBValue.h" | 35 #include "modules/indexeddb/IDBValue.h" |
| 36 #include "platform/SharedBuffer.h" | 36 #include "platform/SharedBuffer.h" |
| 37 #include "public/platform/modules/indexeddb/WebIDBCursor.h" | 37 #include "public/platform/modules/indexeddb/WebIDBCursor.h" |
| 38 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" | 38 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" |
| 39 #include "public/platform/modules/indexeddb/WebIDBDatabaseError.h" | 39 #include "public/platform/modules/indexeddb/WebIDBDatabaseError.h" |
| 40 #include "public/platform/modules/indexeddb/WebIDBKey.h" | 40 #include "public/platform/modules/indexeddb/WebIDBKey.h" |
| 41 #include "public/platform/modules/indexeddb/WebIDBValue.h" | 41 #include "public/platform/modules/indexeddb/WebIDBValue.h" |
| 42 #include "wtf/PtrUtil.h" | |
| 43 #include <memory> | |
| 44 | 42 |
| 45 using blink::WebIDBCursor; | 43 using blink::WebIDBCursor; |
| 46 using blink::WebIDBDatabase; | 44 using blink::WebIDBDatabase; |
| 47 using blink::WebIDBDatabaseError; | 45 using blink::WebIDBDatabaseError; |
| 48 using blink::WebIDBKey; | 46 using blink::WebIDBKey; |
| 49 using blink::WebIDBKeyPath; | 47 using blink::WebIDBKeyPath; |
| 50 using blink::WebIDBMetadata; | 48 using blink::WebIDBMetadata; |
| 51 using blink::WebIDBValue; | 49 using blink::WebIDBValue; |
| 52 using blink::WebVector; | 50 using blink::WebVector; |
| 53 | 51 |
| 54 namespace blink { | 52 namespace blink { |
| 55 | 53 |
| 56 // static | 54 // static |
| 57 std::unique_ptr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* req
uest) | 55 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) |
| 58 { | 56 { |
| 59 return wrapUnique(new WebIDBCallbacksImpl(request)); | 57 return adoptPtr(new WebIDBCallbacksImpl(request)); |
| 60 } | 58 } |
| 61 | 59 |
| 62 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) | 60 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) |
| 63 : m_request(request) | 61 : m_request(request) |
| 64 { | 62 { |
| 65 InspectorInstrumentation::asyncTaskScheduled(m_request->getExecutionContext(
), "IndexedDB", this, true); | 63 InspectorInstrumentation::asyncTaskScheduled(m_request->getExecutionContext(
), "IndexedDB", this, true); |
| 66 } | 64 } |
| 67 | 65 |
| 68 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() | 66 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
| 69 { | 67 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 Vector<String> stringList; | 79 Vector<String> stringList; |
| 82 for (size_t i = 0; i < webStringList.size(); ++i) | 80 for (size_t i = 0; i < webStringList.size(); ++i) |
| 83 stringList.append(webStringList[i]); | 81 stringList.append(webStringList[i]); |
| 84 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 82 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 85 m_request->onSuccess(stringList); | 83 m_request->onSuccess(stringList); |
| 86 } | 84 } |
| 87 | 85 |
| 88 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) | 86 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) |
| 89 { | 87 { |
| 90 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 88 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 91 m_request->onSuccess(wrapUnique(cursor), key, primaryKey, IDBValue::create(v
alue)); | 89 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(val
ue)); |
| 92 } | 90 } |
| 93 | 91 |
| 94 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) | 92 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) |
| 95 { | 93 { |
| 96 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 94 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 97 m_request->onSuccess(wrapUnique(backend), IDBDatabaseMetadata(metadata)); | 95 m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); |
| 98 } | 96 } |
| 99 | 97 |
| 100 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) | 98 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
| 101 { | 99 { |
| 102 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 100 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 103 m_request->onSuccess(key); | 101 m_request->onSuccess(key); |
| 104 } | 102 } |
| 105 | 103 |
| 106 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) | 104 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) |
| 107 { | 105 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 138 | 136 |
| 139 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) | 137 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) |
| 140 { | 138 { |
| 141 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 139 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 142 m_request->onBlocked(oldVersion); | 140 m_request->onBlocked(oldVersion); |
| 143 } | 141 } |
| 144 | 142 |
| 145 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) | 143 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) |
| 146 { | 144 { |
| 147 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 145 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 148 m_request->onUpgradeNeeded(oldVersion, wrapUnique(database), IDBDatabaseMeta
data(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); | 146 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetada
ta(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); |
| 149 } | 147 } |
| 150 | 148 |
| 151 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |