Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2013-10-21 13:52:27 +02:00
commit 3b594cead0
23 changed files with 68 additions and 86 deletions

View File

@ -602,5 +602,19 @@ nsresult MediaDecoderReader::DecodeToTarget(int64_t aTarget)
return NS_OK;
}
nsresult
MediaDecoderReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered,
int64_t aStartTime)
{
MediaResource* stream = mDecoder->GetResource();
int64_t durationUs = 0;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
durationUs = mDecoder->GetMediaDuration();
}
GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
return NS_OK;
}
} // namespace mozilla

View File

@ -525,9 +525,21 @@ public:
// Populates aBuffered with the time ranges which are buffered. aStartTime
// must be the presentation time of the first frame in the media, e.g.
// the media time corresponding to playback time/position 0. This function
// should only be called on the main thread.
// is called on the main, decode, and state machine threads.
//
// This base implementation in MediaDecoderReader estimates the time ranges
// buffered by interpolating the cached byte ranges with the duration
// of the media. Reader subclasses should override this method if they
// can quickly calculate the buffered ranges more accurately.
//
// The primary advantage of this implementation in the reader base class
// is that it's a fast approximation, which does not perform any I/O.
//
// The OggReader relies on this base implementation not performing I/O,
// since in FirefoxOS we can't do I/O on the main thread, where this is
// called.
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
int64_t aStartTime) = 0;
int64_t aStartTime);
class VideoQueueMemoryFunctor : public nsDequeFunctor {
public:

View File

@ -515,16 +515,4 @@ AppleMP3Reader::Seek(int64_t aTime,
return NS_OK;
}
nsresult
AppleMP3Reader::GetBuffered(dom::TimeRanges* aBuffered,
int64_t aStartTime)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
GetEstimatedBufferedTimeRanges(mDecoder->GetResource(),
mDecoder->GetMediaDuration(),
aBuffered);
return NS_OK;
}
} // namespace mozilla

View File

@ -38,9 +38,6 @@ public:
int64_t aEndTime,
int64_t aCurrentTime) MOZ_OVERRIDE;
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
int64_t aStartTime) MOZ_OVERRIDE;
void AudioSampleCallback(UInt32 aNumBytes,
UInt32 aNumPackets,
const void *aData,

View File

@ -331,20 +331,6 @@ DirectShowReader::Seek(int64_t aTargetUs,
return DecodeToTarget(aTargetUs);
}
nsresult
DirectShowReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered,
int64_t aStartTime)
{
MediaResource* stream = mDecoder->GetResource();
int64_t durationUs = 0;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
durationUs = mDecoder->GetMediaDuration();
}
GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
return NS_OK;
}
void
DirectShowReader::OnDecodeThreadStart()
{

View File

@ -65,9 +65,6 @@ public:
int64_t aEndTime,
int64_t aCurrentTime) MOZ_OVERRIDE;
nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered,
int64_t aStartTime) MOZ_OVERRIDE;
void OnDecodeThreadStart() MOZ_OVERRIDE;
void OnDecodeThreadFinish() MOZ_OVERRIDE;

View File

@ -1755,15 +1755,7 @@ nsresult OggReader::GetBuffered(TimeRanges* aBuffered, int64_t aStartTime)
return NS_ERROR_FAILURE;
}
#ifdef OGG_ESTIMATE_BUFFERED
MediaResource* stream = mDecoder->GetResource();
int64_t durationUs = 0;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
durationUs = mDecoder->GetMediaDuration();
}
GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
return NS_OK;
return MediaDecoderReader::GetBuffered(aBuffered, aStartTime);
#else
// HasAudio and HasVideo are not used here as they take a lock and cause
// a deadlock. Accessing mInfo doesn't require a lock - it doesn't change

View File

@ -329,21 +329,6 @@ nsresult MediaPluginReader::Seek(int64_t aTarget, int64_t aStartTime, int64_t aE
return DecodeToTarget(aTarget);
}
nsresult MediaPluginReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime)
{
if (!mPlugin)
return NS_OK;
MediaResource* stream = mDecoder->GetResource();
int64_t durationUs = 0;
mPlugin->GetDuration(mPlugin, &durationUs);
GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
return NS_OK;
}
MediaPluginReader::ImageBufferCallback::ImageBufferCallback(mozilla::layers::ImageContainer *aImageContainer) :
mImageContainer(aImageContainer)
{

View File

@ -64,7 +64,6 @@ public:
virtual nsresult ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags);
virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
virtual nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime);
class ImageBufferCallback : public MPAPI::BufferCallback {
typedef mozilla::layers::Image Image;
public:

View File

@ -1028,17 +1028,4 @@ WMFReader::Seek(int64_t aTargetUs,
return DecodeToTarget(aTargetUs);
}
nsresult
WMFReader::GetBuffered(mozilla::dom::TimeRanges* aBuffered, int64_t aStartTime)
{
MediaResource* stream = mDecoder->GetResource();
int64_t durationUs = 0;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
durationUs = mDecoder->GetMediaDuration();
}
GetEstimatedBufferedTimeRanges(stream, durationUs, aBuffered);
return NS_OK;
}
} // namespace mozilla

View File

@ -48,9 +48,6 @@ public:
int64_t aEndTime,
int64_t aCurrentTime) MOZ_OVERRIDE;
nsresult GetBuffered(mozilla::dom::TimeRanges* aBuffered,
int64_t aStartTime) MOZ_OVERRIDE;
void OnDecodeThreadStart() MOZ_OVERRIDE;
void OnDecodeThreadFinish() MOZ_OVERRIDE;

View File

@ -675,7 +675,8 @@ nsresult nsGeolocationService::Init()
#endif
#ifdef MOZ_WIDGET_COCOA
if (Preferences::GetBool("geo.provider.use_corelocation", false)) {
if (Preferences::GetBool("geo.provider.use_corelocation", true) &&
CoreLocationLocationProvider::IsCoreLocationAvailable()) {
mProvider = new CoreLocationLocationProvider();
}
#endif

View File

@ -32,6 +32,8 @@ public:
NS_DECL_NSIGEOLOCATIONPROVIDER
CoreLocationLocationProvider();
static bool IsCoreLocationAvailable();
private:
virtual ~CoreLocationLocationProvider() {};

View File

@ -17,6 +17,12 @@
#include <CoreLocation/CLLocationManager.h>
#include <CoreLocation/CLLocationManagerDelegate.h>
#include <objc/objc.h>
#include <objc/objc-runtime.h>
#include "nsObjCExceptions.h"
#import <CoreWLAN/CoreWLAN.h>
using namespace mozilla;
static const CLLocationAccuracy kHIGH_ACCURACY = kCLLocationAccuracyBest;
@ -125,6 +131,35 @@ CoreLocationLocationProvider::CoreLocationLocationProvider()
{
}
bool
CoreLocationLocationProvider::IsCoreLocationAvailable()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@try {
NSBundle * bundle = [[[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/CoreWLAN.framework"] autorelease];
if (!bundle) {
[pool release];
return false;
}
Class CWI_class = [bundle classNamed:@"CWInterface"];
if (!CWI_class) {
[pool release];
return false;
}
if ([[[CWI_class interface] interfaceState] intValue] == kCWInterfaceStateRunning) {
[pool release];
return true;
}
}
@catch(NSException *e) {
}
[pool release];
return false;
}
NS_IMETHODIMP
CoreLocationLocationProvider::Startup()
{

View File

@ -15,7 +15,6 @@
#ifdef JS_THREADSAFE
# include "prcvar.h"
# include "prlock.h"
# include "prtypes.h"
#endif
#include "js/Vector.h"

View File

@ -8,7 +8,6 @@
#include "CSFLog.h"
#include "base/basictypes.h"
#include "prtypes.h"
#include <map>
#include "cpr_threads.h"

View File

@ -5,7 +5,6 @@
#include "cpr_types.h"
#include "cpr_stdlib.h"
#include "thread_monitor.h"
#include "prtypes.h"
#include "mozilla/Assertions.h"
/*

View File

@ -11,7 +11,6 @@
#include "prio.h"
#include "plstr.h"
#include "prlog.h"
#include "prtypes.h"
#include "prinrval.h"
#include "mozilla/Mutex.h"

View File

@ -5,7 +5,6 @@
#ifndef prefread_h__
#define prefread_h__
#include "prtypes.h"
#include "prefapi.h"
#ifdef __cplusplus

View File

@ -22,7 +22,6 @@ extern int optind;
#include <math.h>
#include <time.h>
#include <sys/stat.h>
#include "prtypes.h"
#include "prlog.h"
#include "prprf.h"
#include "plhash.h"

View File

@ -8,7 +8,6 @@
// This is the .cpp file where the globals live
#define DHW_IMPLEMENT_GLOBALS
#include <stdio.h>
#include "prtypes.h"
#include "prprf.h"
#include "prlog.h"
#include "plstr.h"

View File

@ -7,8 +7,6 @@
#ifndef trace_malloc_nsTypeInfo_h_
#define trace_malloc_nsTypeInfo_h_
#include "prtypes.h"
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -7,7 +7,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "prtypes.h"
#include "prinrval.h"
#include "prlock.h"
#include "nscore.h"