2010-03-24 10:32:40 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-03-24 10:32:40 +03:00
|
|
|
|
|
|
|
#ifndef mozilla_storage_mozStorageAsyncStatementJSHelper_h_
|
|
|
|
#define mozilla_storage_mozStorageAsyncStatementJSHelper_h_
|
|
|
|
|
|
|
|
#include "nsIXPCScriptable.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace storage {
|
|
|
|
|
2017-08-24 11:52:52 +03:00
|
|
|
class AsyncStatement;
|
|
|
|
class AsyncStatementParams;
|
|
|
|
|
2010-03-24 10:32:40 +03:00
|
|
|
/**
|
|
|
|
* A modified version of StatementJSHelper that only exposes the async-specific
|
|
|
|
* 'params' helper. We do not expose 'row' or 'step' as they do not apply to
|
|
|
|
* us.
|
|
|
|
*/
|
|
|
|
class AsyncStatementJSHelper : public nsIXPCScriptable {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIXPCSCRIPTABLE
|
|
|
|
|
|
|
|
private:
|
2013-08-18 02:50:18 +04:00
|
|
|
nsresult getParams(AsyncStatement*, JSContext*, JSObject*, JS::Value*);
|
2010-03-24 10:32:40 +03:00
|
|
|
};
|
|
|
|
|
2015-03-12 19:55:56 +03:00
|
|
|
/**
|
|
|
|
* Wrapper used to clean up the references JS helpers hold to the statement.
|
|
|
|
* For cycle-avoidance reasons they do not hold reference-counted references,
|
|
|
|
* so it is important we do this.
|
|
|
|
*/
|
2017-08-24 11:52:52 +03:00
|
|
|
class AsyncStatementParamsHolder final : public nsISupports {
|
2015-03-12 19:55:56 +03:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2017-08-24 11:52:52 +03:00
|
|
|
explicit AsyncStatementParamsHolder(AsyncStatementParams* aParams)
|
|
|
|
: mParams(aParams) {}
|
|
|
|
|
|
|
|
AsyncStatementParams* Get() const {
|
|
|
|
MOZ_ASSERT(mParams);
|
|
|
|
return mParams;
|
|
|
|
}
|
2015-03-12 19:55:56 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual ~AsyncStatementParamsHolder();
|
2017-08-24 11:52:52 +03:00
|
|
|
|
|
|
|
RefPtr<AsyncStatementParams> mParams;
|
2015-03-12 19:55:56 +03:00
|
|
|
};
|
|
|
|
|
2010-03-24 10:32:40 +03:00
|
|
|
} // namespace storage
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_storage_mozStorageAsyncStatementJSHelper_h_
|