ipc/glue/BackgroundChildImpl.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/glue/BackgroundChildImpl.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef mozilla_ipc_backgroundchildimpl_h__
     1.9 +#define mozilla_ipc_backgroundchildimpl_h__
    1.10 +
    1.11 +#include "mozilla/Attributes.h"
    1.12 +#include "mozilla/ipc/PBackgroundChild.h"
    1.13 +
    1.14 +template <class> class nsAutoPtr;
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace ipc {
    1.18 +
    1.19 +// Instances of this class should never be created directly. This class is meant
    1.20 +// to be inherited in BackgroundImpl.
    1.21 +class BackgroundChildImpl : public PBackgroundChild
    1.22 +{
    1.23 +public:
    1.24 +  class ThreadLocal;
    1.25 +
    1.26 +  // Get the ThreadLocal for the current thread if
    1.27 +  // BackgroundChild::GetOrCreateForCurrentThread() has been called and true was
    1.28 +  // returned (e.g. a valid PBackgroundChild actor has been created or is in the
    1.29 +  // process of being created). Otherwise this function returns null.
    1.30 +  // This functions is implemented in BackgroundImpl.cpp.
    1.31 +  static ThreadLocal*
    1.32 +  GetThreadLocalForCurrentThread();
    1.33 +
    1.34 +protected:
    1.35 +  BackgroundChildImpl();
    1.36 +  virtual ~BackgroundChildImpl();
    1.37 +
    1.38 +  virtual void
    1.39 +  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
    1.40 +
    1.41 +  virtual PBackgroundTestChild*
    1.42 +  AllocPBackgroundTestChild(const nsCString& aTestArg) MOZ_OVERRIDE;
    1.43 +
    1.44 +  virtual bool
    1.45 +  DeallocPBackgroundTestChild(PBackgroundTestChild* aActor) MOZ_OVERRIDE;
    1.46 +};
    1.47 +
    1.48 +class BackgroundChildImpl::ThreadLocal
    1.49 +{
    1.50 +  friend class nsAutoPtr<ThreadLocal>;
    1.51 +
    1.52 +  // Add any members needed here.
    1.53 +
    1.54 +public:
    1.55 +  ThreadLocal();
    1.56 +
    1.57 +private:
    1.58 +  // Only destroyed by nsAutoPtr<ThreadLocal>.
    1.59 +  ~ThreadLocal();
    1.60 +};
    1.61 +
    1.62 +} // namespace ipc
    1.63 +} // namespace mozilla
    1.64 +
    1.65 +#endif // mozilla_ipc_backgroundchildimpl_h__

mercurial