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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp

Issue 2822453003: Wrap large IndexedDB values into Blobs before writing to LevelDB. (Closed)
Patch Set: Fixed Windows compilation. Created 3 years, 6 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 "access to the Indexed Database API is denied in this context."); 75 "access to the Indexed Database API is denied in this context.");
76 return nullptr; 76 return nullptr;
77 } 77 }
78 78
79 IDBRequest* request = 79 IDBRequest* request =
80 IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr); 80 IDBRequest::Create(script_state, IDBAny::CreateNull(), nullptr);
81 81
82 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) 82 if (!IndexedDBClient::From(ExecutionContext::From(script_state))
83 ->AllowIndexedDB(ExecutionContext::From(script_state), 83 ->AllowIndexedDB(ExecutionContext::From(script_state),
84 "Database Listing")) { 84 "Database Listing")) {
85 request->EnqueueResponse( 85 request->HandleResponse(
86 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); 86 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
87 return request; 87 return request;
88 } 88 }
89 89
90 Platform::Current()->IdbFactory()->GetDatabaseNames( 90 Platform::Current()->IdbFactory()->GetDatabaseNames(
91 request->CreateWebCallbacks().release(), 91 request->CreateWebCallbacks().release(),
92 WebSecurityOrigin( 92 WebSecurityOrigin(
93 ExecutionContext::From(script_state)->GetSecurityOrigin())); 93 ExecutionContext::From(script_state)->GetSecurityOrigin()));
94 return request; 94 return request;
95 } 95 }
(...skipping 26 matching lines...) Expand all
122 return nullptr; 122 return nullptr;
123 } 123 }
124 124
125 IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create(); 125 IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create();
126 int64_t transaction_id = IDBDatabase::NextTransactionId(); 126 int64_t transaction_id = IDBDatabase::NextTransactionId();
127 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( 127 IDBOpenDBRequest* request = IDBOpenDBRequest::Create(
128 script_state, database_callbacks, transaction_id, version); 128 script_state, database_callbacks, transaction_id, version);
129 129
130 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) 130 if (!IndexedDBClient::From(ExecutionContext::From(script_state))
131 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { 131 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) {
132 request->EnqueueResponse( 132 request->HandleResponse(
133 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); 133 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
134 return request; 134 return request;
135 } 135 }
136 136
137 Platform::Current()->IdbFactory()->Open( 137 Platform::Current()->IdbFactory()->Open(
138 name, version, transaction_id, request->CreateWebCallbacks().release(), 138 name, version, transaction_id, request->CreateWebCallbacks().release(),
139 database_callbacks->CreateWebCallbacks().release(), 139 database_callbacks->CreateWebCallbacks().release(),
140 WebSecurityOrigin( 140 WebSecurityOrigin(
141 ExecutionContext::From(script_state)->GetSecurityOrigin())); 141 ExecutionContext::From(script_state)->GetSecurityOrigin()));
142 return request; 142 return request;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 exception_state.ThrowSecurityError( 181 exception_state.ThrowSecurityError(
182 "access to the Indexed Database API is denied in this context."); 182 "access to the Indexed Database API is denied in this context.");
183 return nullptr; 183 return nullptr;
184 } 184 }
185 185
186 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( 186 IDBOpenDBRequest* request = IDBOpenDBRequest::Create(
187 script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion); 187 script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion);
188 188
189 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) 189 if (!IndexedDBClient::From(ExecutionContext::From(script_state))
190 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { 190 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) {
191 request->EnqueueResponse( 191 request->HandleResponse(
192 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); 192 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
193 return request; 193 return request;
194 } 194 }
195 195
196 Platform::Current()->IdbFactory()->DeleteDatabase( 196 Platform::Current()->IdbFactory()->DeleteDatabase(
197 name, request->CreateWebCallbacks().release(), 197 name, request->CreateWebCallbacks().release(),
198 WebSecurityOrigin( 198 WebSecurityOrigin(
199 ExecutionContext::From(script_state)->GetSecurityOrigin()), 199 ExecutionContext::From(script_state)->GetSecurityOrigin()),
200 force_close); 200 force_close);
201 return request; 201 return request;
(...skipping 22 matching lines...) Expand all
224 if (!second->IsValid()) { 224 if (!second->IsValid()) {
225 exception_state.ThrowDOMException(kDataError, 225 exception_state.ThrowDOMException(kDataError,
226 IDBDatabase::kNotValidKeyErrorMessage); 226 IDBDatabase::kNotValidKeyErrorMessage);
227 return 0; 227 return 0;
228 } 228 }
229 229
230 return static_cast<short>(first->Compare(second)); 230 return static_cast<short>(first->Compare(second));
231 } 231 }
232 232
233 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698