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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_callbacks.h

Issue 7470008: Improve IndexedDB's quota support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style problems Created 9 years, 5 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
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 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" 11 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h " 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
18 18
19 class IndexedDBMsg_CallbacksSuccessIDBIndex; 19 class IndexedDBMsg_CallbacksSuccessIDBIndex;
20 class IndexedDBMsg_CallbacksSuccessIDBTransaction; 20 class IndexedDBMsg_CallbacksSuccessIDBTransaction;
21 21
22 // Template magic to figure out what message to send to the renderer based on 22 // Template magic to figure out what message to send to the renderer based on
23 // which (overloaded) onSuccess method we expect to be called. 23 // which (overloaded) onSuccess method we expect to be called.
24 template <class Type> struct WebIDBToMsgHelper { }; 24 template <class Type> struct WebIDBToMsgHelper { };
25 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> { 25 template <> struct WebIDBToMsgHelper<WebKit::WebIDBIndex> {
26 typedef IndexedDBMsg_CallbacksSuccessIDBIndex MsgType; 26 typedef IndexedDBMsg_CallbacksSuccessIDBIndex MsgType;
27 }; 27 };
28 template <> struct WebIDBToMsgHelper<WebKit::WebIDBTransaction> {
29 typedef IndexedDBMsg_CallbacksSuccessIDBTransaction MsgType;
30 };
31 28
32 // The code the following two classes share. 29 // The code the following two classes share.
33 class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks { 30 class IndexedDBCallbacksBase : public WebKit::WebIDBCallbacks {
34 public: 31 public:
35 IndexedDBCallbacksBase(IndexedDBDispatcherHost* dispatcher_host, 32 IndexedDBCallbacksBase(IndexedDBDispatcherHost* dispatcher_host,
36 int32 response_id); 33 int32 response_id);
37 34
38 virtual ~IndexedDBCallbacksBase(); 35 virtual ~IndexedDBCallbacksBase();
39 36
40 virtual void onError(const WebKit::WebIDBDatabaseError& error); 37 virtual void onError(const WebKit::WebIDBDatabaseError& error);
(...skipping 25 matching lines...) Expand all
66 dispatcher_host()->Send( 63 dispatcher_host()->Send(
67 new typename WebIDBToMsgHelper<WebObjectType>::MsgType(response_id(), 64 new typename WebIDBToMsgHelper<WebObjectType>::MsgType(response_id(),
68 object_id)); 65 object_id));
69 } 66 }
70 67
71 private: 68 private:
72 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); 69 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
73 }; 70 };
74 71
75 template <> 72 template <>
73 class IndexedDBCallbacks<WebKit::WebIDBTransaction>
74 : public IndexedDBCallbacksBase {
75 public:
76 IndexedDBCallbacks(
77 IndexedDBDispatcherHost* dispatcher_host, int32 response_id,
78 const GURL& origin_url)
79 : IndexedDBCallbacksBase(dispatcher_host, response_id),
80 origin_url_(origin_url) {
81 }
82
83 virtual void onSuccess(WebKit::WebIDBTransaction* idb_object);
84 GURL origin_url() const { return origin_url_; }
michaeln 2011/07/27 01:31:35 can this be a const GURL& return value?
dgrogan 2011/07/29 18:14:04 Done.
85
86 private:
87 GURL origin_url_;
88 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
89 };
90
91 template <>
76 class IndexedDBCallbacks<WebKit::WebIDBDatabase> 92 class IndexedDBCallbacks<WebKit::WebIDBDatabase>
77 : public IndexedDBCallbacksBase { 93 : public IndexedDBCallbacksBase {
78 public: 94 public:
79 IndexedDBCallbacks( 95 IndexedDBCallbacks(
80 IndexedDBDispatcherHost* dispatcher_host, int32 response_id, 96 IndexedDBDispatcherHost* dispatcher_host, int32 response_id,
81 const GURL& origin_url) 97 const GURL& origin_url)
82 : IndexedDBCallbacksBase(dispatcher_host, response_id), 98 : IndexedDBCallbacksBase(dispatcher_host, response_id),
83 origin_url_(origin_url) { 99 origin_url_(origin_url) {
84 } 100 }
85 101
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 IndexedDBDispatcherHost* dispatcher_host, int32 response_id) 153 IndexedDBDispatcherHost* dispatcher_host, int32 response_id)
138 : IndexedDBCallbacksBase(dispatcher_host, response_id) { } 154 : IndexedDBCallbacksBase(dispatcher_host, response_id) { }
139 155
140 virtual void onSuccess(const WebKit::WebSerializedScriptValue& value); 156 virtual void onSuccess(const WebKit::WebSerializedScriptValue& value);
141 157
142 private: 158 private:
143 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); 159 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
144 }; 160 };
145 161
146 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_ 162 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698