Commit 6e06a1b6 authored by jsbell@chromium.org's avatar jsbell@chromium.org

IndexedDB: Simplify cursor data callbacks.

Removing temporary code put in place to allow WK92278 to land.


Review URL: https://chromiumcodereview.appspot.com/10854081

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151715 0039d316-1c4b-4281-b951-d872f2087c98
parent e59e30dc
......@@ -53,20 +53,6 @@ void IndexedDBCallbacks<WebKit::WebIDBDatabase>::onUpgradeNeeded(
old_version));
}
// TODO(jsbell): Remove this after WK92278 rolls.
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
WebKit::WebIDBCursor* idb_object) {
int32 object_id = dispatcher_host()->Add(idb_object);
IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
params.thread_id = thread_id();
params.response_id = response_id();
params.cursor_id = object_id;
params.key = IndexedDBKey(idb_object->key());
params.primary_key = IndexedDBKey(idb_object->primaryKey());
params.serialized_value = SerializedScriptValue(idb_object->value());
dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
WebKit::WebIDBCursor* idb_object,
const WebKit::WebIDBKey& key,
......@@ -90,26 +76,6 @@ void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
thread_id(), response_id(), SerializedScriptValue(value)));
}
// TODO(jsbell): Remove this after WK92278 rolls.
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithContinuation() {
DCHECK(cursor_id_ != -1);
WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId(
cursor_id_);
DCHECK(idb_cursor);
if (!idb_cursor)
return;
IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
params.thread_id = thread_id();
params.response_id = response_id();
params.cursor_id = cursor_id_;
params.key = IndexedDBKey(idb_cursor->key());
params.primary_key = IndexedDBKey(idb_cursor->primaryKey());
params.serialized_value = SerializedScriptValue(idb_cursor->value());
dispatcher_host()->Send(
new IndexedDBMsg_CallbacksSuccessCursorContinue(params));
}
void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
const WebKit::WebIDBKey& key,
const WebKit::WebIDBKey& primaryKey,
......
......@@ -105,14 +105,6 @@ class IndexedDBCallbacks : public IndexedDBCallbacksBase {
DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
};
// TODO(jsbell): Remove this preamble comment after WK92278 rolls.
// Pre WK92278:
// WebIDBCursor uses onSuccess(WebIDBCursor*) when a cursor has been opened,
// onSuccessWithContinuation() when a continue() call has succeeded, or
// onSuccess(SerializedScriptValue::nullValue()) to indicate it does
// not contain any data, i.e., there is no key within the key range,
// or it has reached the end.
// Post WK92278:
// WebIDBCursor uses:
// * onSuccess(WebIDBCursor*, WebIDBKey, WebIDBKey, SerializedScriptValue)
// when an openCursor()/openKeyCursor() call has succeeded,
......@@ -133,8 +125,6 @@ class IndexedDBCallbacks<WebKit::WebIDBCursor>
: IndexedDBCallbacksBase(dispatcher_host, thread_id, response_id),
cursor_id_(cursor_id) { }
// TODO(jsbell): Remove this after WK92278 rolls.
virtual void onSuccess(WebKit::WebIDBCursor* idb_object);
virtual void onSuccess(WebKit::WebIDBCursor* idb_object,
const WebKit::WebIDBKey& key,
const WebKit::WebIDBKey& primaryKey,
......@@ -143,8 +133,6 @@ class IndexedDBCallbacks<WebKit::WebIDBCursor>
const WebKit::WebIDBKey& primaryKey,
const WebKit::WebSerializedScriptValue& value);
virtual void onSuccess(const WebKit::WebSerializedScriptValue& value);
// TODO(jsbell): Remove this after WK92278 rolls.
virtual void onSuccessWithContinuation();
virtual void onSuccessWithPrefetch(
const WebKit::WebVector<WebKit::WebIDBKey>& keys,
const WebKit::WebVector<WebKit::WebIDBKey>& primaryKeys,
......
......@@ -929,36 +929,6 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::Send(
parent_->Send(message);
}
// TODO(jsbell): Remove this after WK92278 rolls.
void IndexedDBDispatcherHost::CursorDispatcherHost::OnKey(
int32 object_id, IndexedDBKey* key) {
WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id);
if (!idb_cursor)
return;
*key = IndexedDBKey(idb_cursor->key());
}
// TODO(jsbell): Remove this after WK92278 rolls.
void IndexedDBDispatcherHost::CursorDispatcherHost::OnPrimaryKey(
int32 object_id, IndexedDBKey* primary_key) {
WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id);
if (!idb_cursor)
return;
*primary_key = IndexedDBKey(idb_cursor->primaryKey());
}
// TODO(jsbell): Remove this after WK92278 rolls.
void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue(
int32 object_id,
SerializedScriptValue* script_value) {
WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, object_id);
if (!idb_cursor)
return;
*script_value = SerializedScriptValue(idb_cursor->value());
}
void IndexedDBDispatcherHost::CursorDispatcherHost::OnAdvance(
int32 cursor_id,
......
......@@ -243,12 +243,6 @@ class IndexedDBDispatcherHost : public content::BrowserMessageFilter {
bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok);
void Send(IPC::Message* message);
// TODO(jsbell): Remove the next three methods after WK92278 rolls.
void OnKey(int32 idb_object_store_id, content::IndexedDBKey* key);
void OnPrimaryKey(int32 idb_object_store_id,
content::IndexedDBKey* primary_key);
void OnValue(int32 idb_object_store_id,
content::SerializedScriptValue* script_value);
void OnUpdate(int32 idb_object_store_id,
int32 thread_id,
int32 response_id,
......
......@@ -637,9 +637,6 @@ void IndexedDBDispatcher::OnSuccessOpenCursor(
RendererWebIDBCursorImpl* cursor = new RendererWebIDBCursorImpl(object_id);
cursors_[object_id] = cursor;
// TODO(jsbell): Remove the next two calls after WK92278 rolls.
cursor->SetKeyAndValue(key, primary_key, value);
callbacks->onSuccess(cursor);
callbacks->onSuccess(cursor, key, primary_key, value);
pending_callbacks_.Remove(response_id);
......@@ -656,15 +653,11 @@ void IndexedDBDispatcher::OnSuccessCursorContinue(
RendererWebIDBCursorImpl* cursor = cursors_[cursor_id];
DCHECK(cursor);
// TODO(jsbell): Remove the next call after WK92278·rolls.
cursor->SetKeyAndValue(key, primary_key, value);
WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
if (!callbacks)
return;
// TODO(jsbell): Remove the ...WithContinuation call after WK92278 rolls.
callbacks->onSuccessWithContinuation();
callbacks->onSuccess(key, primary_key, value);
pending_callbacks_.Remove(response_id);
......
......@@ -37,21 +37,6 @@ RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() {
dispatcher->CursorDestroyed(idb_cursor_id_);
}
// TODO(jsbell): Remove the following method after WK92278 rolls.
WebIDBKey RendererWebIDBCursorImpl::key() const {
return key_;
}
// TODO(jsbell): Remove the following method after WK92278 rolls.
WebIDBKey RendererWebIDBCursorImpl::primaryKey() const {
return primary_key_;
}
// TODO(jsbell): Remove the following method after WK92278 rolls.
WebSerializedScriptValue RendererWebIDBCursorImpl::value() const {
return value_;
}
void RendererWebIDBCursorImpl::advance(unsigned long count,
WebIDBCallbacks* callbacks_ptr,
WebExceptionCode& ec) {
......@@ -123,16 +108,6 @@ void RendererWebIDBCursorImpl::postSuccessHandlerCallback() {
ResetPrefetchCache();
}
// TODO(jsbell): Remove the following method after WK92278 rolls.
void RendererWebIDBCursorImpl::SetKeyAndValue(
const IndexedDBKey& key,
const IndexedDBKey& primary_key,
const SerializedScriptValue& value) {
key_ = key;
primary_key_ = primary_key;
value_ = value;
}
void RendererWebIDBCursorImpl::SetPrefetchData(
const std::vector<IndexedDBKey>& keys,
const std::vector<IndexedDBKey>& primary_keys,
......@@ -151,10 +126,9 @@ void RendererWebIDBCursorImpl::CachedContinue(
DCHECK(prefetch_primary_keys_.size() == prefetch_keys_.size());
DCHECK(prefetch_values_.size() == prefetch_keys_.size());
// TODO(jsbell): Turn these three variables into locals after WK92278 rolls.
key_ = prefetch_keys_.front();
primary_key_ = prefetch_primary_keys_.front();
value_ = prefetch_values_.front();
IndexedDBKey key = prefetch_keys_.front();
IndexedDBKey primary_key = prefetch_primary_keys_.front();
SerializedScriptValue value = prefetch_values_.front();
prefetch_keys_.pop_front();
prefetch_primary_keys_.pop_front();
......@@ -163,9 +137,7 @@ void RendererWebIDBCursorImpl::CachedContinue(
pending_onsuccess_callbacks_++;
// TODO(jsbell): Remove the ...WithContinuation call after WK92278 rolls.
callbacks->onSuccessWithContinuation();
callbacks->onSuccess(key_, primary_key_, value_);
callbacks->onSuccess(key, primary_key, value);
}
void RendererWebIDBCursorImpl::ResetPrefetchCache() {
......
......@@ -21,10 +21,6 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor {
explicit RendererWebIDBCursorImpl(int32 idb_cursor_id);
virtual ~RendererWebIDBCursorImpl();
// TODO(jsbell): Remove the following three methods after WK92278 rolls.
virtual WebKit::WebIDBKey key() const;
virtual WebKit::WebIDBKey primaryKey() const;
virtual WebKit::WebSerializedScriptValue value() const;
virtual void advance(unsigned long count,
WebKit::WebIDBCallbacks* callback,
WebKit::WebExceptionCode& ec);
......@@ -35,10 +31,6 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor {
WebKit::WebExceptionCode& ec);
virtual void postSuccessHandlerCallback();
// TODO(jsbell): Remove the following method after WK92278 rolls.
void SetKeyAndValue(const content::IndexedDBKey& key,
const content::IndexedDBKey& primary_key,
const content::SerializedScriptValue& value);
void SetPrefetchData(
const std::vector<content::IndexedDBKey>& keys,
const std::vector<content::IndexedDBKey>& primary_keys,
......@@ -50,11 +42,6 @@ class RendererWebIDBCursorImpl : public WebKit::WebIDBCursor {
private:
int32 idb_cursor_id_;
// TODO(jsbell): Remove the following three members after WK92278 rolls.
content::IndexedDBKey key_;
content::IndexedDBKey primary_key_;
content::SerializedScriptValue value_;
// Prefetch cache.
std::deque<content::IndexedDBKey> prefetch_keys_;
std::deque<content::IndexedDBKey> prefetch_primary_keys_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment