| 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> |
| 42 | 44 |
| 43 using blink::WebIDBCursor; | 45 using blink::WebIDBCursor; |
| 44 using blink::WebIDBDatabase; | 46 using blink::WebIDBDatabase; |
| 45 using blink::WebIDBDatabaseError; | 47 using blink::WebIDBDatabaseError; |
| 46 using blink::WebIDBKey; | 48 using blink::WebIDBKey; |
| 47 using blink::WebIDBKeyPath; | 49 using blink::WebIDBKeyPath; |
| 48 using blink::WebIDBMetadata; | 50 using blink::WebIDBMetadata; |
| 49 using blink::WebIDBValue; | 51 using blink::WebIDBValue; |
| 50 using blink::WebVector; | 52 using blink::WebVector; |
| 51 | 53 |
| 52 namespace blink { | 54 namespace blink { |
| 53 | 55 |
| 54 // static | 56 // static |
| 55 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* request) | 57 std::unique_ptr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(IDBRequest* req
uest) |
| 56 { | 58 { |
| 57 return adoptPtr(new WebIDBCallbacksImpl(request)); | 59 return wrapUnique(new WebIDBCallbacksImpl(request)); |
| 58 } | 60 } |
| 59 | 61 |
| 60 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) | 62 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request) |
| 61 : m_request(request) | 63 : m_request(request) |
| 62 { | 64 { |
| 63 InspectorInstrumentation::asyncTaskScheduled(m_request->getExecutionContext(
), "IndexedDB", this, true); | 65 InspectorInstrumentation::asyncTaskScheduled(m_request->getExecutionContext(
), "IndexedDB", this, true); |
| 64 } | 66 } |
| 65 | 67 |
| 66 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() | 68 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
| 67 { | 69 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 79 Vector<String> stringList; | 81 Vector<String> stringList; |
| 80 for (size_t i = 0; i < webStringList.size(); ++i) | 82 for (size_t i = 0; i < webStringList.size(); ++i) |
| 81 stringList.append(webStringList[i]); | 83 stringList.append(webStringList[i]); |
| 82 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 84 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 83 m_request->onSuccess(stringList); | 85 m_request->onSuccess(stringList); |
| 84 } | 86 } |
| 85 | 87 |
| 86 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) | 88 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key,
const WebIDBKey& primaryKey, const WebIDBValue& value) |
| 87 { | 89 { |
| 88 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 90 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 89 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, IDBValue::create(val
ue)); | 91 m_request->onSuccess(wrapUnique(cursor), key, primaryKey, IDBValue::create(v
alue)); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) | 94 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat
a& metadata) |
| 93 { | 95 { |
| 94 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 96 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 95 m_request->onSuccess(adoptPtr(backend), IDBDatabaseMetadata(metadata)); | 97 m_request->onSuccess(wrapUnique(backend), IDBDatabaseMetadata(metadata)); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) | 100 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
| 99 { | 101 { |
| 100 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 102 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 101 m_request->onSuccess(key); | 103 m_request->onSuccess(key); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) | 106 void WebIDBCallbacksImpl::onSuccess(const WebIDBValue& value) |
| 105 { | 107 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 136 | 138 |
| 137 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) | 139 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) |
| 138 { | 140 { |
| 139 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 141 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 140 m_request->onBlocked(oldVersion); | 142 m_request->onBlocked(oldVersion); |
| 141 } | 143 } |
| 142 | 144 |
| 143 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) | 145 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase*
database, const WebIDBMetadata& metadata, unsigned short dataLoss, WebString dat
aLossMessage) |
| 144 { | 146 { |
| 145 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); | 147 InspectorInstrumentation::AsyncTask asyncTask(m_request->getExecutionContext
(), this); |
| 146 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), IDBDatabaseMetada
ta(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); | 148 m_request->onUpgradeNeeded(oldVersion, wrapUnique(database), IDBDatabaseMeta
data(metadata), static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage); |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace blink | 151 } // namespace blink |
| OLD | NEW |