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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc

Issue 12035081: IndexedDB: Specify reason when aborting due to quota (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/test/data/indexeddb/quota_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/in_process_webkit/indexed_db_dispatcher_host.h" 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/process.h" 11 #include "base/process.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 14 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
15 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 15 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
16 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" 16 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h"
17 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" 17 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h"
18 #include "content/browser/renderer_host/render_message_filter.h" 18 #include "content/browser/renderer_host/render_message_filter.h"
19 #include "content/common/indexed_db/indexed_db_messages.h" 19 #include "content/common/indexed_db/indexed_db_messages.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/user_metrics.h" 21 #include "content/public/browser/user_metrics.h"
22 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
23 #include "content/public/common/result_codes.h" 23 #include "content/public/common/result_codes.h"
24 #include "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h" 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti on.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h"
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
34 #include "webkit/base/file_path_string_conversions.h" 36 #include "webkit/base/file_path_string_conversions.h"
35 #include "webkit/database/database_util.h" 37 #include "webkit/database/database_util.h"
36 38
37 using webkit_database::DatabaseUtil; 39 using webkit_database::DatabaseUtil;
38 using WebKit::WebDOMStringList; 40 using WebKit::WebDOMStringList;
39 using WebKit::WebExceptionCode; 41 using WebKit::WebExceptionCode;
40 using WebKit::WebIDBCallbacks; 42 using WebKit::WebIDBCallbacks;
41 using WebKit::WebIDBCursor; 43 using WebKit::WebIDBCursor;
42 using WebKit::WebIDBDatabase; 44 using WebKit::WebIDBDatabase;
45 using WebKit::WebIDBDatabaseError;
43 using WebKit::WebIDBIndex; 46 using WebKit::WebIDBIndex;
44 using WebKit::WebIDBKey; 47 using WebKit::WebIDBKey;
45 using WebKit::WebIDBMetadata; 48 using WebKit::WebIDBMetadata;
46 using WebKit::WebIDBObjectStore; 49 using WebKit::WebIDBObjectStore;
47 using WebKit::WebIDBTransaction; 50 using WebKit::WebIDBTransaction;
48 using WebKit::WebSecurityOrigin; 51 using WebKit::WebSecurityOrigin;
49 using WebKit::WebSerializedScriptValue; 52 using WebKit::WebSerializedScriptValue;
50 using WebKit::WebVector; 53 using WebKit::WebVector;
51 54
52 namespace content { 55 namespace content {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCommit( 648 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCommit(
646 int32 ipc_database_id, 649 int32 ipc_database_id,
647 int64 transaction_id) { 650 int64 transaction_id) {
648 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 651 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
649 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 652 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
650 &map_, ipc_database_id); 653 &map_, ipc_database_id);
651 if (!database) 654 if (!database)
652 return; 655 return;
653 656
654 int64 host_transaction_id = parent_->HostTransactionId(transaction_id); 657 int64 host_transaction_id = parent_->HostTransactionId(transaction_id);
655 // TODO(dgrogan): Tell the page the transaction aborted because of quota.
656 // http://crbug.com/113118
657 // TODO(alecflett) move the map to the parent DispatcherHost (parent_) 658 // TODO(alecflett) move the map to the parent DispatcherHost (parent_)
658 if (parent_->Context()->WouldBeOverQuota( 659 if (parent_->Context()->WouldBeOverQuota(
659 transaction_url_map_[host_transaction_id], 660 transaction_url_map_[host_transaction_id],
660 transaction_size_map_[host_transaction_id])) { 661 transaction_size_map_[host_transaction_id])) {
661 database->abort(host_transaction_id); 662 database->abort(host_transaction_id, WebIDBDatabaseError(
662 return; 663 WebKit::WebIDBDatabaseExceptionQuotaError));
664 return;
663 } 665 }
664 666
665 database->commit(host_transaction_id); 667 database->commit(host_transaction_id);
666 } 668 }
667 669
668 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateIndex( 670 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateIndex(
669 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params) { 671 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params) {
670 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 672 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
671 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 673 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
672 &map_, params.ipc_database_id); 674 &map_, params.ipc_database_id);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 902 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
901 int32 ipc_object_id) { 903 int32 ipc_object_id) {
902 // TODO(dgrogan): This doesn't seem to be happening with some version change 904 // TODO(dgrogan): This doesn't seem to be happening with some version change
903 // transactions. Possibly introduced with integer version support. 905 // transactions. Possibly introduced with integer version support.
904 transaction_ipc_size_map_.erase(ipc_object_id); 906 transaction_ipc_size_map_.erase(ipc_object_id);
905 old_transaction_url_map_.erase(ipc_object_id); 907 old_transaction_url_map_.erase(ipc_object_id);
906 parent_->DestroyObject(&map_, ipc_object_id); 908 parent_->DestroyObject(&map_, ipc_object_id);
907 } 909 }
908 910
909 } // namespace content 911 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/indexeddb/quota_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698