mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 20:47:44 +00:00
883849ee32
This patch was automatically generated using the following script: function convert() { echo "Converting $1 to $2..." find . \ ! -wholename "*/.git*" \ ! -wholename "obj-ff-dbg*" \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert MOZ_OVERRIDE override convert MOZ_FINAL final
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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/. */
|
|
|
|
#ifndef mozilla_dom_TVServiceRunnables_h
|
|
#define mozilla_dom_TVServiceRunnables_h
|
|
|
|
#include "nsITVService.h"
|
|
#include "nsThreadUtils.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
/*
|
|
* NOTE: The callbacks passing to |nsITVService| must be called asynchronously.
|
|
* In the implementation, actual runnable objects may need to be created and
|
|
* call the callback off of the runnables, after the function returns. Here are
|
|
* some ready-made runnables and could be used in the following way.
|
|
*
|
|
* nsCOMPtr<nsIRunnable> runnable =
|
|
* new TVServiceNotifyRunnable(callback, dataList, optional errorCode);
|
|
* return NS_DispatchToCurrentThread(runnable);
|
|
*/
|
|
class TVServiceNotifyRunnable final : public nsRunnable
|
|
{
|
|
public:
|
|
TVServiceNotifyRunnable(nsITVServiceCallback* aCallback,
|
|
nsIArray* aDataList,
|
|
uint16_t aErrorCode = nsITVServiceCallback::TV_ERROR_OK)
|
|
: mCallback(aCallback)
|
|
, mDataList(aDataList)
|
|
, mErrorCode(aErrorCode)
|
|
{}
|
|
|
|
NS_IMETHOD Run()
|
|
{
|
|
if (mErrorCode == nsITVServiceCallback::TV_ERROR_OK) {
|
|
return mCallback->NotifySuccess(mDataList);
|
|
} else {
|
|
return mCallback->NotifyError(mErrorCode);
|
|
}
|
|
}
|
|
|
|
private:
|
|
nsCOMPtr<nsITVServiceCallback> mCallback;
|
|
nsCOMPtr<nsIArray> mDataList;
|
|
uint16_t mErrorCode;
|
|
};
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_dom_TVServiceRunnables_h
|