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

Side by Side Diff: content/common/database_util.cc

Issue 7037018: DB quota (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « content/common/database_util.h ('k') | content/common/db_message_filter.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/database_util.h" 5 #include "content/common/database_util.h"
6 6
7 #include "content/common/child_thread.h" 7 #include "content/common/child_thread.h"
8 #include "content/common/database_messages.h" 8 #include "content/common/database_messages.h"
9 #include "ipc/ipc_sync_message_filter.h" 9 #include "ipc/ipc_sync_message_filter.h"
10 #include "third_party/sqlite/sqlite3.h" 10 #include "third_party/sqlite/sqlite3.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
12 12
13 using WebKit::WebKitClient; 13 using WebKit::WebKitClient;
14 using WebKit::WebString; 14 using WebKit::WebString;
15 15
16 WebKitClient::FileHandle DatabaseUtil::databaseOpenFile( 16 WebKitClient::FileHandle DatabaseUtil::DatabaseOpenFile(
17 const WebString& vfs_file_name, int desired_flags) { 17 const WebString& vfs_file_name, int desired_flags) {
18 IPC::PlatformFileForTransit file_handle = 18 IPC::PlatformFileForTransit file_handle =
19 IPC::InvalidPlatformFileForTransit(); 19 IPC::InvalidPlatformFileForTransit();
20 20
21 scoped_refptr<IPC::SyncMessageFilter> filter( 21 scoped_refptr<IPC::SyncMessageFilter> filter(
22 ChildThread::current()->sync_message_filter()); 22 ChildThread::current()->sync_message_filter());
23 filter->Send(new DatabaseHostMsg_OpenFile( 23 filter->Send(new DatabaseHostMsg_OpenFile(
24 vfs_file_name, desired_flags, &file_handle)); 24 vfs_file_name, desired_flags, &file_handle));
25 25
26 return IPC::PlatformFileForTransitToPlatformFile(file_handle); 26 return IPC::PlatformFileForTransitToPlatformFile(file_handle);
27 } 27 }
28 28
29 int DatabaseUtil::databaseDeleteFile( 29 int DatabaseUtil::DatabaseDeleteFile(
30 const WebString& vfs_file_name, bool sync_dir) { 30 const WebString& vfs_file_name, bool sync_dir) {
31 int rv = SQLITE_IOERR_DELETE; 31 int rv = SQLITE_IOERR_DELETE;
32 scoped_refptr<IPC::SyncMessageFilter> filter( 32 scoped_refptr<IPC::SyncMessageFilter> filter(
33 ChildThread::current()->sync_message_filter()); 33 ChildThread::current()->sync_message_filter());
34 filter->Send(new DatabaseHostMsg_DeleteFile( 34 filter->Send(new DatabaseHostMsg_DeleteFile(
35 vfs_file_name, sync_dir, &rv)); 35 vfs_file_name, sync_dir, &rv));
36 return rv; 36 return rv;
37 } 37 }
38 38
39 long DatabaseUtil::databaseGetFileAttributes(const WebString& vfs_file_name) { 39 long DatabaseUtil::DatabaseGetFileAttributes(const WebString& vfs_file_name) {
40 int32 rv = -1; 40 int32 rv = -1;
41 scoped_refptr<IPC::SyncMessageFilter> filter( 41 scoped_refptr<IPC::SyncMessageFilter> filter(
42 ChildThread::current()->sync_message_filter()); 42 ChildThread::current()->sync_message_filter());
43 filter->Send(new DatabaseHostMsg_GetFileAttributes(vfs_file_name, &rv)); 43 filter->Send(new DatabaseHostMsg_GetFileAttributes(vfs_file_name, &rv));
44 return rv; 44 return rv;
45 } 45 }
46 46
47 long long DatabaseUtil::databaseGetFileSize(const WebString& vfs_file_name) { 47 long long DatabaseUtil::DatabaseGetFileSize(const WebString& vfs_file_name) {
48 int64 rv = 0LL; 48 int64 rv = 0LL;
49 scoped_refptr<IPC::SyncMessageFilter> filter( 49 scoped_refptr<IPC::SyncMessageFilter> filter(
50 ChildThread::current()->sync_message_filter()); 50 ChildThread::current()->sync_message_filter());
51 filter->Send(new DatabaseHostMsg_GetFileSize(vfs_file_name, &rv)); 51 filter->Send(new DatabaseHostMsg_GetFileSize(vfs_file_name, &rv));
52 return rv; 52 return rv;
53 } 53 }
54
55 long long DatabaseUtil::DatabaseGetSpaceAvailable(
56 const WebString& origin_identifier) {
57 int64 rv = 0LL;
58 scoped_refptr<IPC::SyncMessageFilter> filter(
59 ChildThread::current()->sync_message_filter());
60 filter->Send(new DatabaseHostMsg_GetSpaceAvailable(origin_identifier, &rv));
61 return rv;
62 }
OLDNEW
« no previous file with comments | « content/common/database_util.h ('k') | content/common/db_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698