author | Shawn Wilsher <sdwilsh@shawnwilsher.com> |
Thu, 22 Apr 2010 15:59:04 -0700 | |
changeset 43950 | 368acf5610028dfc4ac152b2293fd0df61f7af29 |
parent 43949 | 669f7ab62543cd141f3359cc0df5d10cbce038da |
child 43951 | 13aa9dbfe1e0c16718ea1dab7706506c6945ff99 |
push id | 13972 |
push user | bturner@mozilla.com |
push date | Tue, 22 Jun 2010 03:19:22 +0000 |
treeherder | mozilla-central@89aaaa116328 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 555317 |
milestone | 1.9.3a5pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
|
--- a/dom/interfaces/storage/Makefile.in +++ b/dom/interfaces/storage/Makefile.in @@ -59,11 +59,12 @@ SDK_XPIDLSRCS = \ nsIDOMStorage.idl \ nsIDOMStorageObsolete.idl\ nsIDOMStorageEvent.idl \ nsIDOMStorageEventObsolete.idl \ nsIDOMStorageItem.idl \ nsIDOMStorageList.idl \ nsIDOMStorageWindow.idl \ nsIIndexedDatabaseRequest.idl \ + nsIIDBRequest.idl \ $(NULL) include $(topsrcdir)/config/rules.mk
new file mode 100644 --- /dev/null +++ b/dom/interfaces/storage/nsIIDBRequest.idl @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Indexed Database code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Shawn Wilsher <me@shawnwilsher.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" +interface nsIIDBDatabaseError; +interface nsIVariant; +interface nsIDOMEventListener; + +/** + * IDBReqeust interface. See + * http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBRequest for more + * information. + */ +[scriptable, uuid(2cff021d-e80e-48a7-bb45-00172df02c1c)] +// TODO inherit from nsIEventTarget when the spec is updated. +interface nsIIDBRequest : nsISupports +{ + void abort(); + + const unsigned short INITIAL = 0; + const unsigned short LOADING = 1; + const unsigned short DONE = 2; + readonly attribute unsigned short readyState; + + readonly attribute nsIIDBDatabaseError error; + + readonly attribute nsIVariant result; + + attribute nsIDOMEventListener onsuccess; + + attribute nsIDOMEventListener onerror; +};
new file mode 100644 --- /dev/null +++ b/dom/src/storage/IDBRequest.cpp @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Indexed Database code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Shawn Wilsher <me@shawnwilsher.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "IDBRequest.h" +#include "nsString.h" +#include "nsIScriptContext.h" + +namespace mozilla { +namespace dom { +namespace idb { + +//////////////////////////////////////////////////////////////////////////////// +//// Request + +#define SUCCESS_EVT_STR "success" +#define ERROR_EVT_STR "error" + +Request::Request() +: mReadyState(INITIAL) +{ +} + +//////////////////////////////////////////////////////////////////////////////// +//// nsIIDBRequest + +NS_IMETHODIMP +Request::GetReadyState(PRUint16* aReadyState) +{ + *aReadyState = mReadyState; + return NS_OK; +} + +NS_IMETHODIMP +Request::SetOnsuccess(nsIDOMEventListener* aSuccessListener) +{ + return RemoveAddEventListener(NS_LITERAL_STRING(SUCCESS_EVT_STR), + mOnSuccessListener, aSuccessListener); +} + +NS_IMETHODIMP +Request::GetOnsuccess(nsIDOMEventListener** aSuccessListener) +{ + return GetInnerEventListener(mOnSuccessListener, aSuccessListener); +} + +NS_IMETHODIMP +Request::SetOnerror(nsIDOMEventListener* aErrorListener) +{ + return RemoveAddEventListener(NS_LITERAL_STRING(ERROR_EVT_STR), + mOnErrorListener, aErrorListener); +} + +NS_IMETHODIMP +Request::GetOnerror(nsIDOMEventListener** aErrorListener) +{ + return GetInnerEventListener(mOnErrorListener, aErrorListener); +} + +//////////////////////////////////////////////////////////////////////////////// +//// nsISupports + +NS_IMPL_CYCLE_COLLECTION_CLASS(Request) + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(Request, + nsDOMEventTargetHelper) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnSuccessListener) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnErrorListener) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Request, + nsDOMEventTargetHelper) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnSuccessListener) + NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener) +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Request) + NS_INTERFACE_MAP_ENTRY(nsIIDBRequest) +NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper) + +NS_IMPL_ADDREF_INHERITED(Request, nsDOMEventTargetHelper) +NS_IMPL_RELEASE_INHERITED(Request, nsDOMEventTargetHelper) + +} // namespace idb +} // namepsace dom +} // namespace mozilla
new file mode 100644 --- /dev/null +++ b/dom/src/storage/IDBRequest.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Indexed Database code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Shawn Wilsher <me@shawnwilsher.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef mozilla_dom_idb_request_h__ +#define mozilla_dom_idb_request_h__ + +#include "nsIIDBRequest.h" +#include "nsDOMEventTargetHelper.h" +#include "nsCycleCollectionParticipant.h" +#include "nsCOMPtr.h" + +namespace mozilla { +namespace dom { +namespace idb { + +class Request : public nsDOMEventTargetHelper + , public nsIIDBRequest + +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIIDBREQUEST + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Request, + nsDOMEventTargetHelper) + + Request(); + +protected: + PRUint16 mReadyState; + +private: + nsRefPtr<nsDOMEventListenerWrapper> mOnSuccessListener; + nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener; +}; + +} // namespace idb +} // namepsace dom +} // namespace mozilla + +#endif // mozilla_dom_idb_request_h__
--- a/dom/src/storage/Makefile.in +++ b/dom/src/storage/Makefile.in @@ -43,23 +43,23 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = dom LIBRARY_NAME = jsdomstorage_s LIBXUL_LIBRARY = 1 -CPPSRCS = \ - nsDOMStorage.cpp \ - $(NULL) - -ifdef MOZ_STORAGE -CPPSRCS += nsDOMStorageDBWrapper.cpp nsDOMStoragePersistentDB.cpp nsDOMStorageMemoryDB.cpp -endif +CPPSRCS = \ + nsDOMStorage.cpp \ + nsDOMStorageDBWrapper.cpp \ + nsDOMStoragePersistentDB.cpp \ + nsDOMStorageMemoryDB.cpp \ + IDBRequest.cpp \ + $(NULL) # we don't want the shared lib, but we want to force the creation of a static lib. FORCE_STATIC_LIB = 1 LOCAL_INCLUDES = \ -I$(topsrcdir)/dom/base \ -I$(topsrcdir)/content/events/src