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

Unified Diff: chrome/browser/in_process_webkit/indexed_db_callbacks.h

Issue 2740003: Implement IDBDatabase::createObjectStore. Also refactor IndexedDBCallbacks. (Closed)
Patch Set: Make sure indexed_db_context.cc is in the gypi file. Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/in_process_webkit/indexed_db_callbacks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/in_process_webkit/indexed_db_callbacks.h
diff --git a/chrome/browser/in_process_webkit/indexed_db_callbacks.h b/chrome/browser/in_process_webkit/indexed_db_callbacks.h
index 4b104a7229f802525460c9b08e2232e598200f08..8b845d8026f4cb35101557776adc4578df957b46 100644
--- a/chrome/browser/in_process_webkit/indexed_db_callbacks.h
+++ b/chrome/browser/in_process_webkit/indexed_db_callbacks.h
@@ -6,28 +6,32 @@
#define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CALLBACKS_H_
#include "base/basictypes.h"
+#include "base/logging.h"
#include "base/ref_counted.h"
+#include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h"
#include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h"
-class IndexedDBDispatcherHost;
+template <class WebObjectType, typename SuccessMsgType, typename ErrorMsgType>
class IndexedDBCallbacks : public WebKit::WebIDBCallbacks {
public:
- IndexedDBCallbacks(IndexedDBDispatcherHost* parent, int32 response_id);
- virtual ~IndexedDBCallbacks();
+ IndexedDBCallbacks(
+ IndexedDBDispatcherHost* dispatcher_host, int32 response_id)
+ : dispatcher_host_(dispatcher_host), response_id_(response_id) { }
- // We define default versions of these functions which simply DCHECK.
- // For each WebIDBCallbacks implementation, there should only be one success
- // callback that can possibly be called.
- virtual void onSuccess(WebKit::WebIDBDatabase* idb_database);
- virtual void onSuccess(const WebKit::WebSerializedScriptValue& value);
+ virtual void onError(const WebKit::WebIDBDatabaseError& error) {
+ dispatcher_host_->Send(new ErrorMsgType(
+ response_id_, error.code(), error.message()));
+ }
- protected:
- IndexedDBDispatcherHost* parent() { return parent_.get(); }
- int32 response_id() const { return response_id_; }
+ virtual void onSuccess(WebObjectType* idb_object) {
+ int32 object_id = dispatcher_host_->Add(idb_object);
+ dispatcher_host_->Send(new SuccessMsgType(response_id_, object_id));
+ }
private:
- scoped_refptr<IndexedDBDispatcherHost> parent_;
+ scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
int32 response_id_;
DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
« no previous file with comments | « no previous file | chrome/browser/in_process_webkit/indexed_db_callbacks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698