tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ReportDecodeResultTask.h (906B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef ReportDecodeResultTask_h_
      8 #define ReportDecodeResultTask_h_
      9 
     10 #include "MediaBufferDecoder.h"
     11 
     12 namespace mozilla {
     13 
     14 class ReportDecodeResultTask final : public Runnable {
     15 public:
     16  ReportDecodeResultTask(DecodeJob& aDecodeJob, DecodeJob::ResultFn aFunction)
     17      : mDecodeJob(aDecodeJob), mFunction(aFunction) {
     18    MOZ_ASSERT(aFunction);
     19  }
     20 
     21  NS_IMETHOD Run() override {
     22    MOZ_ASSERT(NS_IsMainThread());
     23 
     24    (mDecodeJob.*mFunction)();
     25 
     26    return NS_OK;
     27  }
     28 
     29 private:
     30  DecodeJob& mDecodeJob;
     31  DecodeJob::ResultFn mFunction;
     32 };
     33 
     34 }  // namespace mozilla
     35 
     36 #endif