Bug 947734 - Build netwerk/protocol/about in unified mode; r=mcmanus

This commit is contained in:
Ehsan Akhgari 2013-12-09 08:17:11 -05:00
parent 4861a013ac
commit d2c607fd8e
4 changed files with 25 additions and 32 deletions

View File

@ -14,7 +14,7 @@ EXPORTS += [
'nsAboutProtocolUtils.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'nsAboutBlank.cpp',
'nsAboutBloat.cpp',
'nsAboutCache.cpp',

View File

@ -10,25 +10,10 @@
#include "nsCOMPtr.h"
#include "nsNetUtil.h"
#include "nsEscape.h"
#include "nsAboutProtocolUtils.h"
#include "nsICacheService.h"
static PRTime SecondsToPRTime(uint32_t t_sec)
{
PRTime t_usec, usec_per_sec;
t_usec = t_sec;
usec_per_sec = PR_USEC_PER_SEC;
return t_usec *= usec_per_sec;
}
static void PrintTimeString(char *buf, uint32_t bufsize, uint32_t t_sec)
{
PRExplodedTime et;
PRTime t_usec = SecondsToPRTime(t_sec);
PR_ExplodeTime(t_usec, PR_LocalTimeParameters, &et);
PR_FormatTime(buf, bufsize, "%Y-%m-%d %H:%M:%S", &et);
}
NS_IMPL_ISUPPORTS2(nsAboutCache, nsIAboutModule, nsICacheVisitor)
NS_IMETHODIMP

View File

@ -11,6 +11,7 @@
#include "nsEscape.h"
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsAboutProtocolUtils.h"
#include <algorithm>
#define HEXDUMP_MAX_ROWS 16
@ -173,21 +174,6 @@ nsAboutCacheEntry::OpenCacheEntry(nsIURI *uri)
// helper methods
//-----------------------------------------------------------------------------
static PRTime SecondsToPRTime(uint32_t t_sec)
{
PRTime t_usec, usec_per_sec;
t_usec = t_sec;
usec_per_sec = PR_USEC_PER_SEC;
return t_usec *= usec_per_sec;
}
static void PrintTimeString(char *buf, uint32_t bufsize, uint32_t t_sec)
{
PRExplodedTime et;
PRTime t_usec = SecondsToPRTime(t_sec);
PR_ExplodeTime(t_usec, PR_LocalTimeParameters, &et);
PR_FormatTime(buf, bufsize, "%Y-%m-%d %H:%M:%S", &et);
}
#define APPEND_ROW(label, value) \
PR_BEGIN_MACRO \
buffer.AppendLiteral(" <tr>\n" \

View File

@ -2,11 +2,15 @@
* 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 nsAboutProtocolUtils_h
#define nsAboutProtocolUtils_h
#include "nsIURI.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIAboutModule.h"
#include "nsServiceManagerUtils.h"
#include "prtime.h"
inline nsresult
NS_GetAboutModuleName(nsIURI *aAboutURI, nsCString& aModule)
@ -47,3 +51,21 @@ NS_GetAboutModule(nsIURI *aAboutURI, nsIAboutModule** aModule)
return CallGetService(contractID.get(), aModule);
}
inline PRTime SecondsToPRTime(uint32_t t_sec)
{
PRTime t_usec, usec_per_sec;
t_usec = t_sec;
usec_per_sec = PR_USEC_PER_SEC;
return t_usec *= usec_per_sec;
}
inline void PrintTimeString(char *buf, uint32_t bufsize, uint32_t t_sec)
{
PRExplodedTime et;
PRTime t_usec = SecondsToPRTime(t_sec);
PR_ExplodeTime(t_usec, PR_LocalTimeParameters, &et);
PR_FormatTime(buf, bufsize, "%Y-%m-%d %H:%M:%S", &et);
}
#endif