Backed out changeset a1628c9ba4af (bug 929029) for timeouts/crashes in test_dataChannel_basicAudio.html.

This commit is contained in:
Ryan VanderMeulen 2013-12-02 12:12:45 -05:00
parent cc2d1d28c8
commit 0464ebbd62
2 changed files with 17 additions and 20 deletions

View File

@ -452,7 +452,7 @@ nsresult
ChannelMediaResource::OnChannelRedirect(nsIChannel* aOld, nsIChannel* aNew,
uint32_t aFlags)
{
mChannel = new nsMainThreadPtrHolder<nsIChannel>(aNew);
mChannel = aNew;
SetupChannelHeaders();
return NS_OK;
}
@ -501,7 +501,7 @@ ChannelMediaResource::OnDataAvailable(nsIRequest* aRequest,
CopySegmentClosure closure;
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
if (secMan && mChannel.get()) {
if (secMan && mChannel) {
secMan->GetChannelPrincipal(mChannel, getter_AddRefs(closure.mPrincipal));
}
closure.mResource = this;
@ -533,7 +533,7 @@ nsresult ChannelMediaResource::Open(nsIStreamListener **aStreamListener)
return rv;
NS_ASSERTION(mOffset == 0, "Who set mOffset already?");
if (!mChannel.get()) {
if (!mChannel) {
// When we're a clone, the decoder might ask us to Open even though
// we haven't established an mChannel (because we might not need one)
NS_ASSERTION(!aStreamListener,
@ -547,7 +547,7 @@ nsresult ChannelMediaResource::Open(nsIStreamListener **aStreamListener)
nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
NS_ENSURE_TRUE(mChannel.get(), NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(mChannel, NS_ERROR_NULL_POINTER);
NS_ASSERTION(!mListener, "Listener should have been removed by now");
if (aStreamListener) {
@ -713,7 +713,7 @@ void ChannelMediaResource::CloseChannel()
mListener = nullptr;
}
if (mChannel.get()) {
if (mChannel) {
if (mSuspendCount > 0) {
// Resume the channel before we cancel it
PossiblyResume();
@ -811,7 +811,7 @@ void ChannelMediaResource::Suspend(bool aCloseImmediately)
return;
}
if (mChannel.get()) {
if (mChannel) {
if (aCloseImmediately && mCacheStream.IsTransportSeekable()) {
// Kill off our channel right now, but don't tell anyone about it.
mIgnoreClose = true;
@ -849,7 +849,7 @@ void ChannelMediaResource::Resume()
NS_ASSERTION(mSuspendCount > 0, "Resume without previous Suspend!");
--mSuspendCount;
if (mSuspendCount == 0) {
if (mChannel.get()) {
if (mChannel) {
// Just wake up our existing channel
{
MutexAutoLock lock(mLock);
@ -897,14 +897,12 @@ ChannelMediaResource::RecreateChannel()
nsCOMPtr<nsILoadGroup> loadGroup = element->GetDocumentLoadGroup();
NS_ENSURE_TRUE(loadGroup, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIChannel> channel;
nsresult rv = NS_NewChannel(getter_AddRefs(channel),
nsresult rv = NS_NewChannel(getter_AddRefs(mChannel),
mURI,
nullptr,
loadGroup,
nullptr,
loadFlags);
mChannel = new nsMainThreadPtrHolder<nsIChannel>(channel);
// We have cached the Content-Type, which should not change. Give a hint to
// the channel to avoid a sniffing failure, which would be expected because we
@ -992,7 +990,7 @@ ChannelMediaResource::CacheClientSeek(int64_t aOffset, bool aResume)
if (mSuspendCount > 0) {
// Close the existing channel to force the channel to be recreated at
// the correct offset upon resume.
if (mChannel.get()) {
if (mChannel) {
mIgnoreClose = true;
CloseChannel();
}
@ -1342,7 +1340,7 @@ nsresult FileMediaResource::Close()
// Since mChennel is only accessed by main thread, there is no necessary to
// take the lock.
if (mChannel.get()) {
if (mChannel) {
mChannel->Cancel(NS_ERROR_PARSED_DATA_CACHED);
mChannel = nullptr;
}
@ -1356,7 +1354,7 @@ already_AddRefed<nsIPrincipal> FileMediaResource::GetCurrentPrincipal()
nsCOMPtr<nsIPrincipal> principal;
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
if (!secMan || !mChannel.get())
if (!secMan || !mChannel)
return nullptr;
secMan->GetChannelPrincipal(mChannel, getter_AddRefs(principal));
return principal.forget();
@ -1525,7 +1523,7 @@ MediaResource::Create(MediaDecoder* aDecoder, nsIChannel* aChannel)
void BaseMediaResource::MoveLoadsToBackground() {
NS_ASSERTION(!mLoadInBackground, "Why are you calling this more than once?");
mLoadInBackground = true;
if (!mChannel.get()) {
if (!mChannel) {
// No channel, resource is probably already loaded.
return;
}

View File

@ -13,7 +13,6 @@
#include "nsIStreamListener.h"
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsProxyRelease.h"
#include "MediaCache.h"
#include "mozilla/Attributes.h"
#include "mozilla/TimeStamp.h"
@ -396,7 +395,7 @@ protected:
class BaseMediaResource : public MediaResource {
public:
virtual nsIURI* URI() const { return const_cast<nsIURI*>(mURI.get()); }
virtual nsIURI* URI() const { return mURI; }
virtual void MoveLoadsToBackground();
protected:
@ -405,8 +404,8 @@ protected:
nsIURI* aURI,
const nsACString& aContentType) :
mDecoder(aDecoder),
mChannel(new nsMainThreadPtrHolder<nsIChannel>(aChannel)),
mURI(new nsMainThreadPtrHolder<nsIURI>(aURI)),
mChannel(aChannel),
mURI(aURI),
mContentType(aContentType),
mLoadInBackground(false)
{
@ -439,11 +438,11 @@ protected:
// Channel used to download the media data. Must be accessed
// from the main thread only.
nsMainThreadPtrHandle<nsIChannel> mChannel;
nsCOMPtr<nsIChannel> mChannel;
// URI in case the stream needs to be re-opened. Access from
// main thread only.
nsMainThreadPtrHandle<nsIURI> mURI;
nsCOMPtr<nsIURI> mURI;
// Content-Type of the channel. This is copied from the nsIChannel when the
// MediaResource is created. This is constant, so accessing from any thread