mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
78ceb79db1
- Bug 1248863 - IonMonkey: MIPS: Fix MDefinition::constantValue re-factored. r=luke (c38ce4f8dd)
- Bug 1231024 - narrow the live range for values. r=jandem (bfe06e964d)
- Bug 1248007 part 1 - Refactor useBox and friends to work more like useRegister. r=nbp (8585828647)
- Bug 1248007 part 2 - Remove unused This operands from LCallDirectEval. r=nbp (ca16fc594e)
- Bug 1248598 part 3 - Enable i64 on x64 and various related changes. r=sunfish (75311df85c)
- Bug 1248863 - IonMonkey: MIPS32: Fix LIRGeneratorMIPS::visitBox. r=arai (2d6f64ed18)
- Bug 1244889 - Handle all SIMD types in js::SimdTypeToName. r=bbouvier (7e8952b52d)
- Bug 1244889 - Add support for Uint32x4 as an asm.js type. r=luke (cab8e0e725)
- Bug 1244889 - Fix Float32x4toUint32x4 for asm.js. r=bbouvier (3b34875729)
- Bug 1244889 - Disallow unsigned SIMD types for global variables. r=luke (cde605325d)
- Bug 1201934 - Remove SIMD shiftRight***ByScalar. r=sunfish (db2a308c6f)
- Bug 1246800 - Masked shift-by-scalar amounts. r=sunfish (58f335a1cf)
- Bug 1226017 - Drop support for b2g desktop in reftests, r=jgriffin (b71bfbea26)
- Bug 1231261 - Append plugins to extra profile files instead of overwriting. r=dbaron (cce158e2bf)
- Bug 1193223 - Add reftest support to mach test, r=chmanchester (44e12e1622)
- Bug 1087791 - Add |mach {reftest,crashtest,jstestbrowser}| for mobile/android. r=nalexander (711a6eb376)
- Bug 1087791 - Follow-up on 340c1df41b69 (pushed wrong version of patch); r=nalexander (d4e7b53834)
- Bug 1228636 - Add mach support for running reftests on mulet, r=jgriffin (25fa23feb4)
- Bug 1232792 - Convert JS callsites to use open2 within layout/ (r=sicking) (8ee4616658)
- Bug 1196831 - Add 'run-until-failure' and 'repeat' flags to reftest. r=jmaher (7792c9fa22)
- Bug 1215148 - Object-count based leak checking for Mochitest. r=jgriffin (afe3a307b2)
- Bug 1219371 - Add suppression for Aurora-only Windows leak. r=erahm (2e74e92da2)
- Bug 1218393 - Give a summary for object-count leak checking. r=jgriffin (b1bd4844e9)
- Bug 1219919 - Add suppressions for Windows-specific content process graphics leaks. r=erahm (a651f412b3)
- Bug 1140394 - Protect standard output from interleaving. r=ahal (0ef5d8f71f)
- Bug 1034290 - Use structured log output for test results in reftest, r=jmaher (3e93bd862b)
- Bug 1249787 - OdinMonkey: Add offset and align fields to the encoding of load and store. r=luke (822e9b01f9)
- Bug 1248203 - streamline h2 stream flow control buffer r=hurley (739a39a255)
- Bug 1221320 - XMLHttpRequest authentication should not require auth prompt dialog, r=honzab.moz (12d9bcc6d0)
- Bug 1158543 - Remove SpdyConnectTransaction::mRequestHead and make the base class mRequestHead protected; r=mcmanus (9678015004)
- Bug 844948 - Allow changing padding of themed button on OS X. r=mstange,heycam (56cbcffbfe)
- Bug 1248983 - Fix spelling for nsCocoaWindow.mm. r=jdm (e185ad5889)
- Bug 917505 - Add WEBGL_compressed_texture_es3 support. r=jgilbert r=smaug (bf4ef11229)
- Bug 1243072 - Make GfxTexturesReporter work again r=nical,jgilbert (6942d70ecf)
96 lines
2.4 KiB
C++
96 lines
2.4 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* 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/. */
|
|
|
|
#include "SimpleBuffer.h"
|
|
#include <algorithm>
|
|
|
|
namespace mozilla {
|
|
namespace net {
|
|
|
|
SimpleBuffer::SimpleBuffer()
|
|
: mStatus(NS_OK)
|
|
, mAvailable(0)
|
|
{
|
|
mOwningThread = PR_GetCurrentThread();
|
|
}
|
|
|
|
nsresult SimpleBuffer::Write(char *src, size_t len)
|
|
{
|
|
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
|
if (NS_FAILED(mStatus)) {
|
|
return mStatus;
|
|
}
|
|
|
|
while (len > 0) {
|
|
SimpleBufferPage *p = mBufferList.getLast();
|
|
if (p && (p->mWriteOffset == SimpleBufferPage::kSimpleBufferPageSize)) {
|
|
// no room.. make a new page
|
|
p = nullptr;
|
|
}
|
|
if (!p) {
|
|
p = new (fallible) SimpleBufferPage();
|
|
if (!p) {
|
|
mStatus = NS_ERROR_OUT_OF_MEMORY;
|
|
return mStatus;
|
|
}
|
|
mBufferList.insertBack(p);
|
|
}
|
|
size_t roomOnPage = SimpleBufferPage::kSimpleBufferPageSize - p->mWriteOffset;
|
|
size_t toWrite = std::min(roomOnPage, len);
|
|
memcpy(p->mBuffer + p->mWriteOffset, src, toWrite);
|
|
src += toWrite;
|
|
len -= toWrite;
|
|
p->mWriteOffset += toWrite;
|
|
mAvailable += toWrite;
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
size_t SimpleBuffer::Read(char *dest, size_t maxLen)
|
|
{
|
|
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
|
if (NS_FAILED(mStatus)) {
|
|
return 0;
|
|
}
|
|
|
|
size_t rv = 0;
|
|
for (SimpleBufferPage *p = mBufferList.getFirst();
|
|
p && (rv < maxLen); p = mBufferList.getFirst()) {
|
|
size_t avail = p->mWriteOffset - p->mReadOffset;
|
|
size_t toRead = std::min(avail, (maxLen - rv));
|
|
memcpy(dest + rv, p->mBuffer + p->mReadOffset, toRead);
|
|
rv += toRead;
|
|
p->mReadOffset += toRead;
|
|
if (p->mReadOffset == p->mWriteOffset) {
|
|
p->remove();
|
|
delete p;
|
|
}
|
|
}
|
|
|
|
MOZ_ASSERT(mAvailable >= rv);
|
|
mAvailable -= rv;
|
|
return rv;
|
|
}
|
|
|
|
size_t SimpleBuffer::Available()
|
|
{
|
|
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
|
return NS_SUCCEEDED(mStatus) ? mAvailable : 0;
|
|
}
|
|
|
|
void SimpleBuffer::Clear()
|
|
{
|
|
MOZ_ASSERT(PR_GetCurrentThread() == mOwningThread);
|
|
SimpleBufferPage *p;
|
|
while ((p = mBufferList.popFirst())) {
|
|
delete p;
|
|
}
|
|
mAvailable = 0;
|
|
}
|
|
|
|
} // namespace net
|
|
} // namespace mozilla
|