dom/workers/TextDecoder.h
author Masatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 22 Dec 2012 09:16:14 +0900
changeset 125948 ac143af3f698c4dc79710b724180c160864ae11a
child 126308 abfe3957551b2a11ba2dc601a0d5a24ba24e8f38
permissions -rw-r--r--
Bug 795542 - Part 2: Implement StringEncoding API objects in Workers. r=bent

/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* 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_workers_textdecoder_h_
#define mozilla_dom_workers_textdecoder_h_

#include "mozilla/dom/TextDecoderBase.h"
#include "mozilla/dom/workers/bindings/DOMBindingBase.h"
#include "mozilla/dom/TextDecoderBinding.h"

BEGIN_WORKERS_NAMESPACE

class TextDecoder MOZ_FINAL : public DOMBindingBase,
                              public TextDecoderBase
{
protected:
  TextDecoder(JSContext* aCx)
  : DOMBindingBase(aCx)
  {}

  virtual
  ~TextDecoder()
  {}

public:
  virtual void
  _trace(JSTracer* aTrc) MOZ_OVERRIDE;

  virtual void
  _finalize(JSFreeOp* aFop) MOZ_OVERRIDE;

  static TextDecoder*
  Constructor(JSContext* aCx, JSObject* aObj,
              const nsAString& aEncoding,
              const TextDecoderOptionsWorkers& aOptions,
              ErrorResult& aRv);

  void
  Decode(const ArrayBufferView* aView,
         const TextDecodeOptionsWorkers& aOptions,
         nsAString& aOutDecodedString,
         ErrorResult& aRv) {
    return TextDecoderBase::Decode(aView, aOptions.mStream,
                                   aOutDecodedString, aRv);
  }
};

END_WORKERS_NAMESPACE

#endif // mozilla_dom_workers_textdecoder_h_