Skip to content

Commit

Permalink
bug 957093 - namespace consistency for netwerk/protocol/http r=sworkman
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmanus committed Jan 7, 2014
1 parent d46904d commit 9bb9605
Show file tree
Hide file tree
Showing 49 changed files with 295 additions and 134 deletions.
22 changes: 13 additions & 9 deletions netwerk/build/nsNetModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,20 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init)
#include "nsHttpDigestAuth.h"
#include "nsHttpNTLMAuth.h"
#include "nsHttpActivityDistributor.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpNTLMAuth)
#undef LOG
#undef LOG_ENABLED
namespace mozilla {
namespace net {
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpNTLMAuth)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpHandler, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpsHandler, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpAuthManager, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpChannelAuthProvider)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpActivityDistributor)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpBasicAuth)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth)
}
}
#endif // !NECKO_PROTOCOL_http

#include "mozilla/net/Dashboard.h"
Expand Down Expand Up @@ -886,14 +890,14 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
{ &kNS_FILEPROTOCOLHANDLER_CID, false, nullptr, nsFileProtocolHandlerConstructor },
#endif
#ifdef NECKO_PROTOCOL_http
{ &kNS_HTTPPROTOCOLHANDLER_CID, false, nullptr, nsHttpHandlerConstructor },
{ &kNS_HTTPSPROTOCOLHANDLER_CID, false, nullptr, nsHttpsHandlerConstructor },
{ &kNS_HTTPBASICAUTH_CID, false, nullptr, nsHttpBasicAuthConstructor },
{ &kNS_HTTPDIGESTAUTH_CID, false, nullptr, nsHttpDigestAuthConstructor },
{ &kNS_HTTPNTLMAUTH_CID, false, nullptr, nsHttpNTLMAuthConstructor },
{ &kNS_HTTPAUTHMANAGER_CID, false, nullptr, nsHttpAuthManagerConstructor },
{ &kNS_HTTPCHANNELAUTHPROVIDER_CID, false, nullptr, nsHttpChannelAuthProviderConstructor },
{ &kNS_HTTPACTIVITYDISTRIBUTOR_CID, false, nullptr, nsHttpActivityDistributorConstructor },
{ &kNS_HTTPPROTOCOLHANDLER_CID, false, nullptr, mozilla::net::nsHttpHandlerConstructor },
{ &kNS_HTTPSPROTOCOLHANDLER_CID, false, nullptr, mozilla::net::nsHttpsHandlerConstructor },
{ &kNS_HTTPBASICAUTH_CID, false, nullptr, mozilla::net::nsHttpBasicAuthConstructor },
{ &kNS_HTTPDIGESTAUTH_CID, false, nullptr, mozilla::net::nsHttpDigestAuthConstructor },
{ &kNS_HTTPNTLMAUTH_CID, false, nullptr, mozilla::net::nsHttpNTLMAuthConstructor },
{ &kNS_HTTPAUTHMANAGER_CID, false, nullptr, mozilla::net::nsHttpAuthManagerConstructor },
{ &kNS_HTTPCHANNELAUTHPROVIDER_CID, false, nullptr, mozilla::net::nsHttpChannelAuthProviderConstructor },
{ &kNS_HTTPACTIVITYDISTRIBUTOR_CID, false, nullptr, mozilla::net::nsHttpActivityDistributorConstructor },
#endif // !NECKO_PROTOCOL_http
#ifdef NECKO_PROTOCOL_ftp
{ &kNS_FTPPROTOCOLHANDLER_CID, false, nullptr, nsFtpProtocolHandlerConstructor },
Expand Down
8 changes: 6 additions & 2 deletions netwerk/protocol/http/ConnectionDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
#include "nsIConsoleService.h"
#include "nsHttpRequestHead.h"

using namespace mozilla;
using namespace mozilla::net;
extern PRThread *gSocketThread;

namespace mozilla {
namespace net {

void
nsHttpConnectionMgr::PrintDiagnostics()
{
Expand Down Expand Up @@ -247,3 +248,6 @@ nsHttpTransaction::PrintDiagnostics(nsCString &log)
log.AppendPrintf(" restart count = %u\n", mRestartCount);
log.AppendPrintf(" classification = 0x%x\n", mClassification);
}

} // namespace mozilla::net
} // namespace mozilla
8 changes: 4 additions & 4 deletions netwerk/protocol/http/HttpChannelChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class HttpChannelChild : public PHttpChannelChild
const uint32_t& cacheExpirationTime,
const nsCString& cachedCharset,
const nsCString& securityInfoSerialization,
const mozilla::net::NetAddr& selfAddr,
const mozilla::net::NetAddr& peerAddr);
const NetAddr& selfAddr,
const NetAddr& peerAddr);
bool RecvOnTransportAndData(const nsresult& status,
const uint64_t& progress,
const uint64_t& progressMax,
Expand Down Expand Up @@ -153,8 +153,8 @@ class HttpChannelChild : public PHttpChannelChild
const uint32_t& cacheExpirationTime,
const nsCString& cachedCharset,
const nsCString& securityInfoSerialization,
const mozilla::net::NetAddr& selfAddr,
const mozilla::net::NetAddr& peerAddr);
const NetAddr& selfAddr,
const NetAddr& peerAddr);
void OnTransportAndData(const nsresult& status,
const uint64_t progress,
const uint64_t& progressMax,
Expand Down
3 changes: 1 addition & 2 deletions netwerk/protocol/http/HttpChannelParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

class nsICacheEntry;
class nsIAssociatedContentSecurity;
class nsHttpHandler;

namespace mozilla {

Expand Down Expand Up @@ -94,7 +93,7 @@ class HttpChannelParent : public PHttpChannelParent
virtual void ActorDestroy(ActorDestroyReason why);

protected:
friend class mozilla::net::HttpChannelParentListener;
friend class HttpChannelParentListener;
nsRefPtr<mozilla::dom::TabParent> mTabParent;

private:
Expand Down
8 changes: 4 additions & 4 deletions netwerk/protocol/http/NullHttpTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
#include "nsAHttpTransaction.h"
#include "mozilla/Attributes.h"

class nsAHttpConnection;
class nsHttpRequestHead;
class nsHttpConnectionInfo;

// This is the minimal nsAHttpTransaction implementation. A NullHttpTransaction
// can be used to drive connection level semantics (such as SSL handshakes
// tunnels) so that a nsHttpConnection becomes fully established in
// anticipation of a real transaction needing to use it soon.

namespace mozilla { namespace net {

class nsAHttpConnection;
class nsHttpConnectionInfo;
class nsHttpRequestHead;

class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction
{
public:
Expand Down
18 changes: 9 additions & 9 deletions netwerk/protocol/http/PHttpChannelParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ struct ParamTraits<mozilla::net::RequestHeaderTuple>
};

template<>
struct ParamTraits<nsHttpAtom>
struct ParamTraits<mozilla::net::nsHttpAtom>
{
typedef nsHttpAtom paramType;
typedef mozilla::net::nsHttpAtom paramType;

static void Write(Message* aMsg, const paramType& aParam)
{
Expand All @@ -82,16 +82,16 @@ struct ParamTraits<nsHttpAtom>
if (!ReadParam(aMsg, aIter, &value))
return false;

*aResult = nsHttp::ResolveAtom(value.get());
*aResult = mozilla::net::nsHttp::ResolveAtom(value.get());
MOZ_ASSERT(aResult->get(), "atom table not initialized");
return true;
}
};

template<>
struct ParamTraits<nsHttpHeaderArray::nsEntry>
struct ParamTraits<mozilla::net::nsHttpHeaderArray::nsEntry>
{
typedef nsHttpHeaderArray::nsEntry paramType;
typedef mozilla::net::nsHttpHeaderArray::nsEntry paramType;

static void Write(Message* aMsg, const paramType& aParam)
{
Expand All @@ -111,9 +111,9 @@ struct ParamTraits<nsHttpHeaderArray::nsEntry>


template<>
struct ParamTraits<nsHttpHeaderArray>
struct ParamTraits<mozilla::net::nsHttpHeaderArray>
{
typedef nsHttpHeaderArray paramType;
typedef mozilla::net::nsHttpHeaderArray paramType;

static void Write(Message* aMsg, const paramType& aParam)
{
Expand All @@ -132,9 +132,9 @@ struct ParamTraits<nsHttpHeaderArray>
};

template<>
struct ParamTraits<nsHttpResponseHead>
struct ParamTraits<mozilla::net::nsHttpResponseHead>
{
typedef nsHttpResponseHead paramType;
typedef mozilla::net::nsHttpResponseHead paramType;

static void Write(Message* aMsg, const paramType& aParam)
{
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/SpdyPush3.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SpdyPushedStream3 MOZ_FINAL : public SpdyStream3
nsCOMPtr<nsILoadGroupConnectionInfo> mLoadGroupCI;

SpdyPush3TransactionBuffer *mBufferedPush;
mozilla::TimeStamp mLastRead;
TimeStamp mLastRead;

nsCString mHashKey;
nsresult mStatus;
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/SpdyPush31.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SpdyPushedStream31 MOZ_FINAL : public SpdyStream31
nsCOMPtr<nsILoadGroupConnectionInfo> mLoadGroupCI;

SpdyPush31TransactionBuffer *mBufferedPush;
mozilla::TimeStamp mLastRead;
TimeStamp mLastRead;

nsCString mHashKey;
nsresult mStatus;
Expand Down
18 changes: 11 additions & 7 deletions netwerk/protocol/http/TimingStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@

#include "mozilla/TimeStamp.h"

namespace mozilla { namespace net {

struct TimingStruct {
mozilla::TimeStamp domainLookupStart;
mozilla::TimeStamp domainLookupEnd;
mozilla::TimeStamp connectStart;
mozilla::TimeStamp connectEnd;
mozilla::TimeStamp requestStart;
mozilla::TimeStamp responseStart;
mozilla::TimeStamp responseEnd;
TimeStamp domainLookupStart;
TimeStamp domainLookupEnd;
TimeStamp connectStart;
TimeStamp connectEnd;
TimeStamp requestStart;
TimeStamp responseStart;
TimeStamp responseEnd;
};

}} // namespace mozilla::net

#endif
11 changes: 7 additions & 4 deletions netwerk/protocol/http/nsAHttpConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
#include "nsISupports.h"
#include "nsAHttpTransaction.h"

class nsHttpRequestHead;
class nsHttpResponseHead;
class nsHttpConnectionInfo;
class nsHttpConnection;
class nsISocketTransport;
class nsIAsyncInputStream;
class nsIAsyncOutputStream;

namespace mozilla { namespace net {

class nsHttpConnectionInfo;
class nsHttpConnection;

//-----------------------------------------------------------------------------
// Abstract base class for a HTTP connection
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -216,4 +217,6 @@ class nsAHttpConnection : public nsISupports
(fwdObject)->SetSecurityCallbacks(aCallbacks); \
}

}} // namespace mozilla::net

#endif // nsAHttpConnection_h__
17 changes: 11 additions & 6 deletions netwerk/protocol/http/nsAHttpTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
#include "nsISupports.h"
#include "nsTArray.h"

class nsAHttpConnection;
class nsAHttpSegmentReader;
class nsAHttpSegmentWriter;
class nsIInterfaceRequestor;
class nsIEventTarget;
class nsITransport;
class nsHttpRequestHead;
class nsHttpPipeline;
class nsHttpTransaction;
class nsILoadGroupConnectionInfo;

namespace mozilla { namespace net {

class nsAHttpConnection;
class nsAHttpSegmentReader;
class nsAHttpSegmentWriter;
class nsHttpTransaction;
class nsHttpPipeline;
class nsHttpRequestHead;

//----------------------------------------------------------------------------
// Abstract base class for a HTTP transaction:
//
Expand Down Expand Up @@ -220,4 +223,6 @@ class nsAHttpSegmentWriter
#define NS_DECL_NSAHTTPSEGMENTWRITER \
nsresult OnWriteSegment(char *, uint32_t, uint32_t *);

}} // namespace mozilla::net

#endif // nsAHttpTransaction_h__
9 changes: 5 additions & 4 deletions netwerk/protocol/http/nsHttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
#include "mozilla/HashFunctions.h"
#include "nsCRT.h"

using namespace mozilla;

#if defined(PR_LOGGING)
PRLogModuleInfo *gHttpLog = nullptr;
#endif

namespace mozilla {
namespace net {

// define storage for all atoms
#define HTTP_ATOM(_name, _value) nsHttpAtom nsHttp::_name = { _value };
#include "nsHttpAtomList.h"
Expand All @@ -32,8 +33,6 @@ enum {
};
#undef HTTP_ATOM

using namespace mozilla;

// we keep a linked list of atoms allocated on the heap for easy clean up when
// the atom table is destroyed. The structure and value string are allocated
// as one contiguous block.
Expand Down Expand Up @@ -324,3 +323,5 @@ nsHttp::IsSafeMethod(nsHttpAtom method)
method == nsHttp::Trace;
}

} // namespace mozilla::net
} // namespace mozilla
7 changes: 4 additions & 3 deletions netwerk/protocol/http/nsHttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace net {
SPDY_VERSION_3 = 3,
SPDY_VERSION_31 = 4
};
} // namespace mozilla::net
} // namespace mozilla

typedef uint8_t nsHttpVersion;

Expand Down Expand Up @@ -105,7 +103,7 @@ struct nsHttp
// The mutex is valid any time the Atom Table is valid
// This mutex is used in the unusual case that the network thread and
// main thread might access the same data
static mozilla::Mutex *GetLock();
static Mutex *GetLock();

// will dynamically add atoms to the table if they don't already exist
static nsHttpAtom ResolveAtom(const char *);
Expand Down Expand Up @@ -189,4 +187,7 @@ PRTimeToSeconds(PRTime t_usec)
#define HTTP_LWS " \t"
#define HTTP_HEADER_VALUE_SEPS HTTP_LWS ","

} // namespace mozilla::net
} // namespace mozilla

#endif // nsHttp_h__
6 changes: 5 additions & 1 deletion netwerk/protocol/http/nsHttpActivityDistributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"

using namespace mozilla;
namespace mozilla {
namespace net {

typedef nsMainThreadPtrHolder<nsIHttpActivityObserver> ObserverHolder;
typedef nsMainThreadPtrHandle<nsIHttpActivityObserver> ObserverHandle;
typedef nsTArray<ObserverHandle> ObserverArray;
Expand Down Expand Up @@ -128,3 +130,5 @@ nsHttpActivityDistributor::RemoveObserver(nsIHttpActivityObserver *aObserver)

return NS_OK;
}
} // namespace mozilla::net
} // namespace mozilla
5 changes: 4 additions & 1 deletion netwerk/protocol/http/nsHttpActivityDistributor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "nsProxyRelease.h"
#include "mozilla/Mutex.h"

namespace mozilla { namespace net {

class nsHttpActivityDistributor : public nsIHttpActivityDistributor
{
Expand All @@ -24,7 +25,9 @@ class nsHttpActivityDistributor : public nsIHttpActivityDistributor

protected:
ObserverArray mObservers;
mozilla::Mutex mLock;
Mutex mLock;
};

}} // namespace mozilla::net

#endif // nsHttpActivityDistributor_h__
Loading

0 comments on commit 9bb9605

Please sign in to comment.