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

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: Rebased. Created 3 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return nullptr; 101 return nullptr;
102 } 102 }
103 103
104 IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create(); 104 IDBDatabaseCallbacks* database_callbacks = IDBDatabaseCallbacks::Create();
105 int64_t transaction_id = IDBDatabase::NextTransactionId(); 105 int64_t transaction_id = IDBDatabase::NextTransactionId();
106 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( 106 IDBOpenDBRequest* request = IDBOpenDBRequest::Create(
107 script_state, database_callbacks, transaction_id, version); 107 script_state, database_callbacks, transaction_id, version);
108 108
109 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) 109 if (!IndexedDBClient::From(ExecutionContext::From(script_state))
110 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { 110 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) {
111 request->EnqueueResponse( 111 request->HandleResponse(
112 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); 112 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
113 return request; 113 return request;
114 } 114 }
115 115
116 Platform::Current()->IdbFactory()->Open( 116 Platform::Current()->IdbFactory()->Open(
117 name, version, transaction_id, request->CreateWebCallbacks().release(), 117 name, version, transaction_id, request->CreateWebCallbacks().release(),
118 database_callbacks->CreateWebCallbacks().release(), 118 database_callbacks->CreateWebCallbacks().release(),
119 WebSecurityOrigin( 119 WebSecurityOrigin(
120 ExecutionContext::From(script_state)->GetSecurityOrigin())); 120 ExecutionContext::From(script_state)->GetSecurityOrigin()));
121 return request; 121 return request;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 IDBOpenDBRequest* IDBFactory::DeleteDatabaseInternal(ScriptState* script_state, 156 IDBOpenDBRequest* IDBFactory::DeleteDatabaseInternal(ScriptState* script_state,
157 const String& name, 157 const String& name,
158 bool force_close) { 158 bool force_close) {
159 IDBOpenDBRequest* request = IDBOpenDBRequest::Create( 159 IDBOpenDBRequest* request = IDBOpenDBRequest::Create(
160 script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion); 160 script_state, nullptr, 0, IDBDatabaseMetadata::kDefaultVersion);
161 161
162 if (!IndexedDBClient::From(ExecutionContext::From(script_state)) 162 if (!IndexedDBClient::From(ExecutionContext::From(script_state))
163 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) { 163 ->AllowIndexedDB(ExecutionContext::From(script_state), name)) {
164 request->EnqueueResponse( 164 request->HandleResponse(
165 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage)); 165 DOMException::Create(kUnknownError, kPermissionDeniedErrorMessage));
166 return request; 166 return request;
167 } 167 }
168 168
169 Platform::Current()->IdbFactory()->DeleteDatabase( 169 Platform::Current()->IdbFactory()->DeleteDatabase(
170 name, request->CreateWebCallbacks().release(), 170 name, request->CreateWebCallbacks().release(),
171 WebSecurityOrigin( 171 WebSecurityOrigin(
172 ExecutionContext::From(script_state)->GetSecurityOrigin()), 172 ExecutionContext::From(script_state)->GetSecurityOrigin()),
173 force_close); 173 force_close);
174 return request; 174 return request;
(...skipping 22 matching lines...) Expand all
197 if (!second->IsValid()) { 197 if (!second->IsValid()) {
198 exception_state.ThrowDOMException(kDataError, 198 exception_state.ThrowDOMException(kDataError,
199 IDBDatabase::kNotValidKeyErrorMessage); 199 IDBDatabase::kNotValidKeyErrorMessage);
200 return 0; 200 return 0;
201 } 201 }
202 202
203 return static_cast<short>(first->Compare(second)); 203 return static_cast<short>(first->Compare(second));
204 } 204 }
205 205
206 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698