parser/html/nsHtml5UTF16BufferCppSupplement.h
author Nathan Froyd <froydnj@mozilla.com>
Thu, 08 Aug 2013 13:55:20 -0400
changeset 141874 a3ea5bc816f5cdf404faafbc8500664024b4efc9
parent 103019 a16372ce30b5f6b747246b01fcd215a4bf3b6342
child 162124 5a9badd6db004310b9d1aca5db25ef4c275a4362
permissions -rw-r--r--
Bug 901947 - part 1 - don't null-check |new X| in content/; r=smaug

/* 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/. */

nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRUnichar* aBuffer, int32_t aEnd)
  : buffer(aBuffer)
  , start(0)
  , end(aEnd)
{
  MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
}

nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer()
{
  MOZ_COUNT_DTOR(nsHtml5UTF16Buffer);
}

void
nsHtml5UTF16Buffer::DeleteBuffer()
{
  delete[] buffer;
}

void
nsHtml5UTF16Buffer::Swap(nsHtml5UTF16Buffer* aOther)
{
  PRUnichar* tempBuffer = buffer;
  int32_t tempStart = start;
  int32_t tempEnd = end;
  buffer = aOther->buffer;
  start = aOther->start;
  end = aOther->end;
  aOther->buffer = tempBuffer;
  aOther->start = tempStart;
  aOther->end = tempEnd;
}