OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/indexed_db/indexed_db_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 }; | 107 }; |
108 | 108 |
109 class IndexedDBDatabase::OpenRequest | 109 class IndexedDBDatabase::OpenRequest |
110 : public IndexedDBDatabase::ConnectionRequest { | 110 : public IndexedDBDatabase::ConnectionRequest { |
111 public: | 111 public: |
112 OpenRequest(scoped_refptr<IndexedDBDatabase> db, | 112 OpenRequest(scoped_refptr<IndexedDBDatabase> db, |
113 std::unique_ptr<IndexedDBPendingConnection> pending_connection) | 113 std::unique_ptr<IndexedDBPendingConnection> pending_connection) |
114 : ConnectionRequest(db), pending_(std::move(pending_connection)) {} | 114 : ConnectionRequest(db), pending_(std::move(pending_connection)) {} |
115 | 115 |
116 void Perform() override { | 116 void Perform() override { |
117 if (!pending_->callbacks->IsValid()) { | |
118 db_->RequestComplete(this); | |
119 return; | |
120 } | |
121 | |
122 if (db_->metadata_.id == kInvalidId) { | 117 if (db_->metadata_.id == kInvalidId) { |
123 // The database was deleted then immediately re-opened; OpenInternal() | 118 // The database was deleted then immediately re-opened; OpenInternal() |
124 // recreates it in the backing store. | 119 // recreates it in the backing store. |
125 if (!db_->OpenInternal().ok()) { | 120 if (!db_->OpenInternal().ok()) { |
126 // TODO(jsbell): Consider including sanitized leveldb status message. | 121 // TODO(jsbell): Consider including sanitized leveldb status message. |
127 base::string16 message; | 122 base::string16 message; |
128 if (pending_->version == IndexedDBDatabaseMetadata::NO_VERSION) { | 123 if (pending_->version == IndexedDBDatabaseMetadata::NO_VERSION) { |
129 message = ASCIIToUTF16( | 124 message = ASCIIToUTF16( |
130 "Internal error opening database with no version specified."); | 125 "Internal error opening database with no version specified."); |
131 } else { | 126 } else { |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 if (status.IsCorruption()) { | 1907 if (status.IsCorruption()) { |
1913 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 1908 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
1914 message); | 1909 message); |
1915 factory_->HandleBackingStoreCorruption(backing_store_->origin(), error); | 1910 factory_->HandleBackingStoreCorruption(backing_store_->origin(), error); |
1916 } else { | 1911 } else { |
1917 factory_->HandleBackingStoreFailure(backing_store_->origin()); | 1912 factory_->HandleBackingStoreFailure(backing_store_->origin()); |
1918 } | 1913 } |
1919 } | 1914 } |
1920 | 1915 |
1921 } // namespace content | 1916 } // namespace content |
OLD | NEW |