mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge b2g-inbound to m-c.
This commit is contained in:
commit
565fe7f416
@ -122,51 +122,6 @@ SettingsListener.observe('language.current', 'en-US', function(value) {
|
||||
});
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.mms.retrieval_mode', 'manual',
|
||||
function(value) {
|
||||
Services.prefs.setCharPref('dom.mms.retrieval_mode', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.sms.strict7BitEncoding.enabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.sms.strict7BitEncoding', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.sms.requestStatusReport.enabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.sms.requestStatusReport', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.mms.requestStatusReport.enabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.mms.requestStatusReport', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.mms.requestReadReport.enabled', true,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.mms.requestReadReport', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.cellbroadcast.disabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('ril.cellbroadcast.disabled', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.radio.disabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('ril.radio.disabled', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('wap.UAProf.url', '',
|
||||
function(value) {
|
||||
Services.prefs.setCharPref('wap.UAProf.url', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('wap.UAProf.tagname', 'x-wap-profile',
|
||||
function(value) {
|
||||
Services.prefs.setCharPref('wap.UAProf.tagname', value);
|
||||
});
|
||||
|
||||
// DSDS default service IDs
|
||||
['mms', 'sms', 'telephony', 'voicemail'].forEach(function(key) {
|
||||
SettingsListener.observe('ril.' + key + '.defaultServiceId', 0,
|
||||
@ -235,10 +190,6 @@ SettingsListener.observe('devtools.overlay', false, (value) => {
|
||||
}
|
||||
});
|
||||
|
||||
SettingsListener.observe('devtools.eventlooplag.threshold', 100, function(value) {
|
||||
Services.prefs.setIntPref('devtools.eventlooplag.threshold', value);
|
||||
});
|
||||
|
||||
// =================== Debugger / ADB ====================
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
@ -525,11 +476,6 @@ SettingsListener.observe('debugger.remote-mode', false, function(value) {
|
||||
#endif
|
||||
});
|
||||
|
||||
|
||||
SettingsListener.observe('debug.log-animations.enabled', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.offmainthreadcomposition.log-animations', value);
|
||||
});
|
||||
|
||||
// =================== Device Storage ====================
|
||||
SettingsListener.observe('device.storage.writable.name', 'sdcard', function(value) {
|
||||
if (Services.prefs.getPrefType('device.storage.writable.name') != Ci.nsIPrefBranch.PREF_STRING) {
|
||||
@ -541,10 +487,6 @@ SettingsListener.observe('device.storage.writable.name', 'sdcard', function(valu
|
||||
});
|
||||
|
||||
// =================== Privacy ====================
|
||||
SettingsListener.observe('privacy.donottrackheader.enabled', false, function(value) {
|
||||
Services.prefs.setBoolPref('privacy.donottrackheader.enabled', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('privacy.donottrackheader.value', 1, function(value) {
|
||||
Services.prefs.setIntPref('privacy.donottrackheader.value', value);
|
||||
// If the user specifically disallows tracking, we set the value of
|
||||
@ -604,22 +546,7 @@ function setUpdateTrackingId() {
|
||||
}
|
||||
setUpdateTrackingId();
|
||||
|
||||
SettingsListener.observe('app.update.interval', 86400, function(value) {
|
||||
Services.prefs.setIntPref('app.update.interval', value);
|
||||
});
|
||||
|
||||
// ================ Debug ================
|
||||
// XXX could factor out into a settings->pref map.
|
||||
SettingsListener.observe("debug.fps.enabled", false, function(value) {
|
||||
Services.prefs.setBoolPref("layers.acceleration.draw-fps", value);
|
||||
});
|
||||
SettingsListener.observe("debug.paint-flashing.enabled", false, function(value) {
|
||||
Services.prefs.setBoolPref("nglayout.debug.paint_flashing", value);
|
||||
});
|
||||
SettingsListener.observe("layers.draw-borders", false, function(value) {
|
||||
Services.prefs.setBoolPref("layers.draw-borders", value);
|
||||
});
|
||||
|
||||
(function Composer2DSettingToPref() {
|
||||
//layers.composer.enabled can be enabled in three ways
|
||||
//In order of precedence they are:
|
||||
@ -675,11 +602,6 @@ SettingsListener.observe("accessibility.screenreader", false, function(value) {
|
||||
})();
|
||||
|
||||
// =================== AsyncPanZoom ======================
|
||||
|
||||
SettingsListener.observe('apz.force-enable', false, function(value) {
|
||||
Services.prefs.setBoolPref('dom.browser_frames.useAsyncPanZoom', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('apz.displayport.heuristics', 'default', function(value) {
|
||||
// first reset everything to default
|
||||
Services.prefs.clearUserPref('apz.velocity_bias');
|
||||
@ -711,19 +633,89 @@ SettingsListener.observe('apz.displayport.heuristics', 'default', function(value
|
||||
}
|
||||
});
|
||||
|
||||
SettingsListener.observe('layers.enable-tiles', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.enable-tiles', value);
|
||||
});
|
||||
// =================== Various simple mapping ======================
|
||||
let settingsToObserve = {
|
||||
'ril.mms.retrieval_mode': {
|
||||
prefName: 'dom.mms.retrieval_mode',
|
||||
defaultValue: 'manual'
|
||||
},
|
||||
'ril.sms.strict7BitEncoding.enabled': {
|
||||
prefName: 'dom.sms.strict7BitEncoding',
|
||||
defaultValue: false
|
||||
},
|
||||
'ril.sms.requestStatusReport.enabled': {
|
||||
prefName: 'dom.sms.requestStatusReport',
|
||||
defaultValue: false
|
||||
},
|
||||
'ril.mms.requestStatusReport.enabled': {
|
||||
prefName: 'dom.mms.requestStatusReport',
|
||||
defaultValue: false
|
||||
},
|
||||
'ril.mms.requestReadReport.enabled': {
|
||||
prefName: 'dom.mms.requestReadReport',
|
||||
defaultValue: true
|
||||
},
|
||||
'ril.cellbroadcast.disabled': false,
|
||||
'ril.radio.disabled': false,
|
||||
'wap.UAProf.url': '',
|
||||
'wap.UAProf.tagname': 'x-wap-profile',
|
||||
'devtools.eventlooplag.threshold': 100,
|
||||
'privacy.donottrackheader.enabled': false,
|
||||
'apz.force-enable': {
|
||||
prefName: 'dom.browser_frames.useAsyncPanZoom',
|
||||
defaultValue: false
|
||||
},
|
||||
'layers.enable-tiles': false,
|
||||
'layers.progressive-paint': false,
|
||||
'layers.draw-tile-borders': false,
|
||||
'layers.dump': false,
|
||||
'debug.fps.enabled': {
|
||||
prefName: 'layers.acceleration.draw-fps',
|
||||
defaultValue: false
|
||||
},
|
||||
'debug.paint-flashing.enabled': {
|
||||
prefName: 'nglayout.debug.paint_flashing',
|
||||
defaultValue: false
|
||||
},
|
||||
'layers.draw-borders': false,
|
||||
'app.update.interval': 86400,
|
||||
'debug.log-animations.enabled': {
|
||||
prefName: 'layers.offmainthreadcomposition.log-animations',
|
||||
defaultValue: false
|
||||
}
|
||||
};
|
||||
|
||||
SettingsListener.observe('layers.progressive-paint', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.progressive-paint', value);
|
||||
});
|
||||
for (let key in settingsToObserve) {
|
||||
let setting = settingsToObserve[key];
|
||||
|
||||
SettingsListener.observe('layers.draw-tile-borders', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.draw-tile-borders', value);
|
||||
});
|
||||
// By default, assume the setting name and the pref name are the same.
|
||||
let prefName = key;
|
||||
let defaultValue = setting;
|
||||
|
||||
SettingsListener.observe('layers.dump', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.dump', value);
|
||||
});
|
||||
// Check if the pref name has been overidden.
|
||||
if (typeof setting == 'object') {
|
||||
prefName = setting.prefName;
|
||||
defaultValue = setting.defaultValue;
|
||||
}
|
||||
|
||||
switch (typeof defaultValue) {
|
||||
case 'boolean':
|
||||
SettingsListener.observe(key, defaultValue, function(value) {
|
||||
Services.prefs.setBoolPref(prefName, value);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
SettingsListener.observe(key, defaultValue, function(value) {
|
||||
Services.prefs.setCharPref(prefName, value);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
SettingsListener.observe(key, defaultValue, function(value) {
|
||||
Services.prefs.setIntPref(prefName, value);
|
||||
});
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"branch": "",
|
||||
"revision": ""
|
||||
},
|
||||
"revision": "020bf0df084e3e80e51f9dfd5fdeef2e8ab90452",
|
||||
"revision": "61e8a88f301aea77f22abdde19a85f0af27ab7f4",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="71f78f7f68fcf5e23cc5965fee0dad45289c438b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6781459a49642ca0eb7ec3e95667808d5d77b656"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
|
||||
|
@ -75,6 +75,12 @@ const ContentPanning = {
|
||||
},
|
||||
|
||||
handleEvent: function cp_handleEvent(evt) {
|
||||
// Ignore events targeting a <iframe mozbrowser> since those will be
|
||||
// handle by the BrowserElementPanning.js instance of it.
|
||||
if (evt.target instanceof Ci.nsIMozBrowserFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.defaultPrevented || evt.multipleActionsPrevented) {
|
||||
// clean up panning state even if touchend/mouseup has been preventDefault.
|
||||
if(evt.type === 'touchend' || evt.type === 'mouseup') {
|
||||
|
@ -101,6 +101,8 @@ public:
|
||||
void GetStatus(nsAString& aStatus);
|
||||
void GetStorageStatus(nsAString& aStatus);
|
||||
void DoFormat(nsAString& aStatus);
|
||||
void DoMount(nsAString& aStatus);
|
||||
void DoUnmount(nsAString& aStatus);
|
||||
static void GetRootDirectoryForType(const nsAString& aStorageType,
|
||||
const nsAString& aStorageName,
|
||||
nsIFile** aFile);
|
||||
@ -246,6 +248,8 @@ public:
|
||||
already_AddRefed<DOMRequest> Available(ErrorResult& aRv);
|
||||
already_AddRefed<DOMRequest> Format(ErrorResult& aRv);
|
||||
already_AddRefed<DOMRequest> StorageStatus(ErrorResult& aRv);
|
||||
already_AddRefed<DOMRequest> Mount(ErrorResult& aRv);
|
||||
already_AddRefed<DOMRequest> Unmount(ErrorResult& aRv);
|
||||
|
||||
bool Default();
|
||||
|
||||
|
@ -156,6 +156,26 @@ DeviceStorageRequestChild::
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageResponseValue::TMountStorageResponse:
|
||||
{
|
||||
MountStorageResponse r = aValue;
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(
|
||||
cx, StringToJsval(mRequest->GetOwner(), r.storageStatus()));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageResponseValue::TUnmountStorageResponse:
|
||||
{
|
||||
UnmountStorageResponse r = aValue;
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(
|
||||
cx, StringToJsval(mRequest->GetOwner(), r.storageStatus()));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageResponseValue::TEnumerationResponse:
|
||||
{
|
||||
EnumerationResponse r = aValue;
|
||||
|
@ -174,6 +174,32 @@ DeviceStorageRequestParent::Dispatch()
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageParams::TDeviceStorageMountParams:
|
||||
{
|
||||
DeviceStorageMountParams p = mParams;
|
||||
|
||||
nsRefPtr<DeviceStorageFile> dsf =
|
||||
new DeviceStorageFile(p.type(), p.storageName());
|
||||
nsRefPtr<PostMountResultEvent> r
|
||||
= new PostMountResultEvent(this, dsf);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageParams::TDeviceStorageUnmountParams:
|
||||
{
|
||||
DeviceStorageUnmountParams p = mParams;
|
||||
|
||||
nsRefPtr<DeviceStorageFile> dsf =
|
||||
new DeviceStorageFile(p.type(), p.storageName());
|
||||
nsRefPtr<PostUnmountResultEvent> r
|
||||
= new PostUnmountResultEvent(this, dsf);
|
||||
DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageParams::TDeviceStorageEnumerationParams:
|
||||
{
|
||||
DeviceStorageEnumerationParams p = mParams;
|
||||
@ -282,6 +308,22 @@ DeviceStorageRequestParent::EnsureRequiredPermissions(
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageParams::TDeviceStorageMountParams:
|
||||
{
|
||||
DeviceStorageMountParams p = mParams;
|
||||
type = p.type();
|
||||
requestType = DEVICE_STORAGE_REQUEST_MOUNT;
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageParams::TDeviceStorageUnmountParams:
|
||||
{
|
||||
DeviceStorageUnmountParams p = mParams;
|
||||
type = p.type();
|
||||
requestType = DEVICE_STORAGE_REQUEST_UNMOUNT;
|
||||
break;
|
||||
}
|
||||
|
||||
case DeviceStorageParams::TDeviceStorageEnumerationParams:
|
||||
{
|
||||
DeviceStorageEnumerationParams p = mParams;
|
||||
@ -900,6 +942,62 @@ DeviceStorageRequestParent::PostFormatResultEvent::CancelableRun()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DeviceStorageRequestParent::PostMountResultEvent::
|
||||
PostMountResultEvent(DeviceStorageRequestParent* aParent,
|
||||
DeviceStorageFile* aFile)
|
||||
: CancelableRunnable(aParent)
|
||||
, mFile(aFile)
|
||||
{
|
||||
}
|
||||
|
||||
DeviceStorageRequestParent::PostMountResultEvent::
|
||||
~PostMountResultEvent()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
DeviceStorageRequestParent::PostMountResultEvent::CancelableRun()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsString state = NS_LITERAL_STRING("unavailable");
|
||||
if (mFile) {
|
||||
mFile->DoMount(state);
|
||||
}
|
||||
|
||||
MountStorageResponse response(state);
|
||||
unused << mParent->Send__delete__(mParent, response);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DeviceStorageRequestParent::PostUnmountResultEvent::
|
||||
PostUnmountResultEvent(DeviceStorageRequestParent* aParent,
|
||||
DeviceStorageFile* aFile)
|
||||
: CancelableRunnable(aParent)
|
||||
, mFile(aFile)
|
||||
{
|
||||
}
|
||||
|
||||
DeviceStorageRequestParent::PostUnmountResultEvent::
|
||||
~PostUnmountResultEvent()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
DeviceStorageRequestParent::PostUnmountResultEvent::CancelableRun()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsString state = NS_LITERAL_STRING("unavailable");
|
||||
if (mFile) {
|
||||
mFile->DoUnmount(state);
|
||||
}
|
||||
|
||||
UnmountStorageResponse response(state);
|
||||
unused << mParent->Send__delete__(mParent, response);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace devicestorage
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -269,6 +269,26 @@ private:
|
||||
nsRefPtr<DeviceStorageFile> mFile;
|
||||
};
|
||||
|
||||
class PostMountResultEvent : public CancelableRunnable
|
||||
{
|
||||
public:
|
||||
PostMountResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
|
||||
virtual ~PostMountResultEvent();
|
||||
virtual nsresult CancelableRun();
|
||||
private:
|
||||
nsRefPtr<DeviceStorageFile> mFile;
|
||||
};
|
||||
|
||||
class PostUnmountResultEvent : public CancelableRunnable
|
||||
{
|
||||
public:
|
||||
PostUnmountResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
|
||||
virtual ~PostUnmountResultEvent();
|
||||
virtual nsresult CancelableRun();
|
||||
private:
|
||||
nsRefPtr<DeviceStorageFile> mFile;
|
||||
};
|
||||
|
||||
protected:
|
||||
bool AddRunnable(CancelableRunnable* aRunnable) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
@ -68,6 +68,16 @@ struct FormatStorageResponse
|
||||
nsString mountState;
|
||||
};
|
||||
|
||||
struct MountStorageResponse
|
||||
{
|
||||
nsString storageStatus;
|
||||
};
|
||||
|
||||
struct UnmountStorageResponse
|
||||
{
|
||||
nsString storageStatus;
|
||||
};
|
||||
|
||||
union DeviceStorageResponseValue
|
||||
{
|
||||
ErrorResponse;
|
||||
@ -80,6 +90,8 @@ union DeviceStorageResponseValue
|
||||
AvailableStorageResponse;
|
||||
StorageStatusResponse;
|
||||
FormatStorageResponse;
|
||||
MountStorageResponse;
|
||||
UnmountStorageResponse;
|
||||
};
|
||||
|
||||
sync protocol PDeviceStorageRequest {
|
||||
|
@ -402,6 +402,8 @@ DeviceStorageTypeChecker::GetAccessForRequest(
|
||||
case DEVICE_STORAGE_REQUEST_WRITE:
|
||||
case DEVICE_STORAGE_REQUEST_DELETE:
|
||||
case DEVICE_STORAGE_REQUEST_FORMAT:
|
||||
case DEVICE_STORAGE_REQUEST_MOUNT:
|
||||
case DEVICE_STORAGE_REQUEST_UNMOUNT:
|
||||
aAccessResult.AssignLiteral("write");
|
||||
break;
|
||||
case DEVICE_STORAGE_REQUEST_CREATE:
|
||||
@ -1358,6 +1360,66 @@ DeviceStorageFile::DoFormat(nsAString& aStatus)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
DeviceStorageFile::DoMount(nsAString& aStatus)
|
||||
{
|
||||
DeviceStorageTypeChecker* typeChecker
|
||||
= DeviceStorageTypeChecker::CreateOrGet();
|
||||
if (!typeChecker) {
|
||||
return;
|
||||
}
|
||||
if (!typeChecker->IsVolumeBased(mStorageType)) {
|
||||
aStatus.AssignLiteral("notVolume");
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(vs);
|
||||
|
||||
nsCOMPtr<nsIVolume> vol;
|
||||
nsresult rv = vs->GetVolumeByName(mStorageName, getter_AddRefs(vol));
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!vol) {
|
||||
return;
|
||||
}
|
||||
|
||||
vol->Mount();
|
||||
|
||||
aStatus.AssignLiteral("mounting");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
DeviceStorageFile::DoUnmount(nsAString& aStatus)
|
||||
{
|
||||
DeviceStorageTypeChecker* typeChecker
|
||||
= DeviceStorageTypeChecker::CreateOrGet();
|
||||
if (!typeChecker) {
|
||||
return;
|
||||
}
|
||||
if (!typeChecker->IsVolumeBased(mStorageType)) {
|
||||
aStatus.AssignLiteral("notVolume");
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE_VOID(vs);
|
||||
|
||||
nsCOMPtr<nsIVolume> vol;
|
||||
nsresult rv = vs->GetVolumeByName(mStorageName, getter_AddRefs(vol));
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!vol) {
|
||||
return;
|
||||
}
|
||||
|
||||
vol->Unmount();
|
||||
|
||||
aStatus.AssignLiteral("unmounting");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
DeviceStorageFile::GetStatus(nsAString& aStatus)
|
||||
{
|
||||
@ -2041,6 +2103,74 @@ private:
|
||||
nsRefPtr<DOMRequest> mRequest;
|
||||
};
|
||||
|
||||
class PostMountResultEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
PostMountResultEvent(DeviceStorageFile *aFile, DOMRequest* aRequest)
|
||||
: mFile(aFile)
|
||||
, mRequest(aRequest)
|
||||
{
|
||||
MOZ_ASSERT(mRequest);
|
||||
}
|
||||
|
||||
~PostMountResultEvent() {}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsString state = NS_LITERAL_STRING("unavailable");
|
||||
if (mFile) {
|
||||
mFile->DoMount(state);
|
||||
}
|
||||
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx,
|
||||
StringToJsval(mRequest->GetOwner(), state));
|
||||
mRequest->FireSuccess(result);
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<DeviceStorageFile> mFile;
|
||||
nsRefPtr<DOMRequest> mRequest;
|
||||
};
|
||||
|
||||
class PostUnmountResultEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
PostUnmountResultEvent(DeviceStorageFile *aFile, DOMRequest* aRequest)
|
||||
: mFile(aFile)
|
||||
, mRequest(aRequest)
|
||||
{
|
||||
MOZ_ASSERT(mRequest);
|
||||
}
|
||||
|
||||
~PostUnmountResultEvent() {}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsString state = NS_LITERAL_STRING("unavailable");
|
||||
if (mFile) {
|
||||
mFile->DoUnmount(state);
|
||||
}
|
||||
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx,
|
||||
StringToJsval(mRequest->GetOwner(), state));
|
||||
mRequest->FireSuccess(result);
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<DeviceStorageFile> mFile;
|
||||
nsRefPtr<DOMRequest> mRequest;
|
||||
};
|
||||
|
||||
class PostResultEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
@ -2781,6 +2911,35 @@ public:
|
||||
return NS_DispatchToCurrentThread(r);
|
||||
}
|
||||
|
||||
case DEVICE_STORAGE_REQUEST_MOUNT:
|
||||
{
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
PDeviceStorageRequestChild* child
|
||||
= new DeviceStorageRequestChild(mRequest, mFile);
|
||||
DeviceStorageMountParams params(mFile->mStorageType,
|
||||
mFile->mStorageName);
|
||||
ContentChild::GetSingleton()
|
||||
->SendPDeviceStorageRequestConstructor(child, params);
|
||||
return NS_OK;
|
||||
}
|
||||
r = new PostMountResultEvent(mFile, mRequest);
|
||||
return NS_DispatchToCurrentThread(r);
|
||||
}
|
||||
|
||||
case DEVICE_STORAGE_REQUEST_UNMOUNT:
|
||||
{
|
||||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
PDeviceStorageRequestChild* child
|
||||
= new DeviceStorageRequestChild(mRequest, mFile);
|
||||
DeviceStorageUnmountParams params(mFile->mStorageType,
|
||||
mFile->mStorageName);
|
||||
ContentChild::GetSingleton()
|
||||
->SendPDeviceStorageRequestConstructor(child, params);
|
||||
return NS_OK;
|
||||
}
|
||||
r = new PostUnmountResultEvent(mFile, mRequest);
|
||||
return NS_DispatchToCurrentThread(r);
|
||||
}
|
||||
}
|
||||
|
||||
if (r) {
|
||||
@ -3535,6 +3694,56 @@ nsDOMDeviceStorage::Format(ErrorResult& aRv)
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
nsDOMDeviceStorage::Mount(ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(win);
|
||||
|
||||
nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType,
|
||||
mStorageName);
|
||||
nsCOMPtr<nsIRunnable> r
|
||||
= new DeviceStorageRequest(DEVICE_STORAGE_REQUEST_MOUNT,
|
||||
win, mPrincipal, dsf, request);
|
||||
nsresult rv = NS_DispatchToCurrentThread(r);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
nsDOMDeviceStorage::Unmount(ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(win);
|
||||
|
||||
nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType,
|
||||
mStorageName);
|
||||
nsCOMPtr<nsIRunnable> r
|
||||
= new DeviceStorageRequest(DEVICE_STORAGE_REQUEST_UNMOUNT,
|
||||
win, mPrincipal, dsf, request);
|
||||
nsresult rv = NS_DispatchToCurrentThread(r);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
return request.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDeviceStorage::CreateFileDescriptor(const nsAString& aPath,
|
||||
DeviceStorageFileDescriptor* aDSFileDescriptor,
|
||||
|
@ -54,6 +54,8 @@ enum DeviceStorageRequestType {
|
||||
DEVICE_STORAGE_REQUEST_AVAILABLE,
|
||||
DEVICE_STORAGE_REQUEST_STATUS,
|
||||
DEVICE_STORAGE_REQUEST_FORMAT,
|
||||
DEVICE_STORAGE_REQUEST_MOUNT,
|
||||
DEVICE_STORAGE_REQUEST_UNMOUNT,
|
||||
DEVICE_STORAGE_REQUEST_CREATEFD
|
||||
};
|
||||
|
||||
|
@ -93,6 +93,18 @@ struct DeviceStorageFormatParams
|
||||
nsString storageName;
|
||||
};
|
||||
|
||||
struct DeviceStorageMountParams
|
||||
{
|
||||
nsString type;
|
||||
nsString storageName;
|
||||
};
|
||||
|
||||
struct DeviceStorageUnmountParams
|
||||
{
|
||||
nsString type;
|
||||
nsString storageName;
|
||||
};
|
||||
|
||||
struct DeviceStorageAddParams
|
||||
{
|
||||
nsString type;
|
||||
@ -143,6 +155,8 @@ union DeviceStorageParams
|
||||
DeviceStorageAvailableParams;
|
||||
DeviceStorageStatusParams;
|
||||
DeviceStorageFormatParams;
|
||||
DeviceStorageMountParams;
|
||||
DeviceStorageUnmountParams;
|
||||
};
|
||||
|
||||
struct FMRadioRequestEnableParams
|
||||
|
@ -259,6 +259,8 @@ public:
|
||||
if (vol->IsSharingEnabled() == aAllowSharing) {
|
||||
return;
|
||||
}
|
||||
vol->SetUnmountRequested(false);
|
||||
vol->SetMountRequested(false);
|
||||
vol->SetSharingEnabled(aAllowSharing);
|
||||
DBG("Calling UpdateState due to volume %s shareing set to %d",
|
||||
vol->NameStr(), (int)aAllowSharing);
|
||||
@ -274,12 +276,46 @@ public:
|
||||
if (vol->IsFormatRequested()) {
|
||||
return;
|
||||
}
|
||||
vol->SetUnmountRequested(false);
|
||||
vol->SetMountRequested(false);
|
||||
vol->SetFormatRequested(true);
|
||||
DBG("Calling UpdateState due to volume %s formatting set to %d",
|
||||
vol->NameStr(), (int)vol->IsFormatRequested());
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void MountVolume(const nsACString& aVolumeName)
|
||||
{
|
||||
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
|
||||
if (!vol) {
|
||||
return;
|
||||
}
|
||||
vol->SetUnmountRequested(false);
|
||||
if (vol->IsMountRequested() || vol->mState == nsIVolume::STATE_MOUNTED) {
|
||||
return;
|
||||
}
|
||||
vol->SetMountRequested(true);
|
||||
DBG("Calling UpdateState due to volume %s mounting set to %d",
|
||||
vol->NameStr(), (int)vol->IsMountRequested());
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
void UnmountVolume(const nsACString& aVolumeName)
|
||||
{
|
||||
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
|
||||
if (!vol) {
|
||||
return;
|
||||
}
|
||||
if (vol->IsUnmountRequested()) {
|
||||
return;
|
||||
}
|
||||
vol->SetMountRequested(false);
|
||||
vol->SetUnmountRequested(true);
|
||||
DBG("Calling UpdateState due to volume %s unmounting set to %d",
|
||||
vol->NameStr(), (int)vol->IsUnmountRequested());
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
AutoVolumeEventObserver mVolumeEventObserver;
|
||||
@ -432,9 +468,11 @@ AutoMounter::UpdateState()
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((tryToShare && vol->IsSharingEnabled()) || vol->IsFormatRequested()) {
|
||||
// We're going to try to unmount and share the volumes
|
||||
if ((tryToShare && vol->IsSharingEnabled()) ||
|
||||
vol->IsFormatRequested() ||
|
||||
vol->IsUnmountRequested()) {
|
||||
switch (volState) {
|
||||
// We're going to try to unmount the volume
|
||||
case nsIVolume::STATE_MOUNTED: {
|
||||
if (vol->IsMountLocked()) {
|
||||
// The volume is currently locked, so leave it in the mounted
|
||||
@ -536,10 +574,12 @@ AutoMounter::UpdateState()
|
||||
return; // UpdateState will be called again when the Unshare command completes
|
||||
}
|
||||
case nsIVolume::STATE_IDLE: {
|
||||
// Volume is unmounted, try to mount.
|
||||
if (!vol->IsUnmountRequested()) {
|
||||
// Volume is unmounted and mount-requested, try to mount.
|
||||
|
||||
LOG("UpdateState: Mounting %s", vol->NameStr());
|
||||
vol->StartMount(mResponseCallback);
|
||||
LOG("UpdateState: Mounting %s", vol->NameStr());
|
||||
vol->StartMount(mResponseCallback);
|
||||
}
|
||||
return; // UpdateState will be called again when Mount command completes
|
||||
}
|
||||
default: {
|
||||
@ -584,6 +624,7 @@ ShutdownAutoMounterIOThread()
|
||||
static void
|
||||
SetAutoMounterModeIOThread(const int32_t& aMode)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
MOZ_ASSERT(sAutoMounter);
|
||||
|
||||
@ -593,6 +634,7 @@ SetAutoMounterModeIOThread(const int32_t& aMode)
|
||||
static void
|
||||
SetAutoMounterSharingModeIOThread(const nsCString& aVolumeName, const bool& aAllowSharing)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
MOZ_ASSERT(sAutoMounter);
|
||||
|
||||
@ -602,12 +644,33 @@ SetAutoMounterSharingModeIOThread(const nsCString& aVolumeName, const bool& aAll
|
||||
static void
|
||||
AutoMounterFormatVolumeIOThread(const nsCString& aVolumeName)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
MOZ_ASSERT(sAutoMounter);
|
||||
|
||||
sAutoMounter->FormatVolume(aVolumeName);
|
||||
}
|
||||
|
||||
static void
|
||||
AutoMounterMountVolumeIOThread(const nsCString& aVolumeName)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
MOZ_ASSERT(sAutoMounter);
|
||||
|
||||
sAutoMounter->MountVolume(aVolumeName);
|
||||
}
|
||||
|
||||
static void
|
||||
AutoMounterUnmountVolumeIOThread(const nsCString& aVolumeName)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
MOZ_ASSERT(sAutoMounter);
|
||||
|
||||
sAutoMounter->UnmountVolume(aVolumeName);
|
||||
}
|
||||
|
||||
static void
|
||||
UsbCableEventIOThread()
|
||||
{
|
||||
@ -776,6 +839,24 @@ AutoMounterFormatVolume(const nsCString& aVolumeName)
|
||||
aVolumeName));
|
||||
}
|
||||
|
||||
void
|
||||
AutoMounterMountVolume(const nsCString& aVolumeName)
|
||||
{
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(AutoMounterMountVolumeIOThread,
|
||||
aVolumeName));
|
||||
}
|
||||
|
||||
void
|
||||
AutoMounterUnmountVolume(const nsCString& aVolumeName)
|
||||
{
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(AutoMounterUnmountVolumeIOThread,
|
||||
aVolumeName));
|
||||
}
|
||||
|
||||
void
|
||||
ShutdownAutoMounter()
|
||||
{
|
||||
|
@ -68,6 +68,24 @@ SetAutoMounterSharingMode(const nsCString& aVolumeName, bool aAllowSharing);
|
||||
void
|
||||
AutoMounterFormatVolume(const nsCString& aVolumeName);
|
||||
|
||||
/**
|
||||
* Mounts the volume with specified volume name.
|
||||
*
|
||||
* If the volume is already unmounted, automounter
|
||||
* will mount it. Otherwise automounter will skip this.
|
||||
*/
|
||||
void
|
||||
AutoMounterMountVolume(const nsCString& aVolumeName);
|
||||
|
||||
/**
|
||||
* Unmounts the volume with specified volume name.
|
||||
*
|
||||
* If the volume is already mounted, automounter
|
||||
* will unmount it. Otherwise automounter will skip this.
|
||||
*/
|
||||
void
|
||||
AutoMounterUnmountVolume(const nsCString& aVolumeName);
|
||||
|
||||
/**
|
||||
* Shuts down the automounter.
|
||||
*
|
||||
|
@ -62,6 +62,8 @@ Volume::Volume(const nsCSubstring& aName)
|
||||
mCanBeShared(true),
|
||||
mIsSharing(false),
|
||||
mFormatRequested(false),
|
||||
mMountRequested(false),
|
||||
mUnmountRequested(false),
|
||||
mIsFormatting(false)
|
||||
{
|
||||
DBG("Volume %s: created", NameStr());
|
||||
@ -151,6 +153,24 @@ Volume::SetFormatRequested(bool aFormatRequested)
|
||||
NameStr(), (int)mFormatRequested, (int)CanBeFormatted());
|
||||
}
|
||||
|
||||
void
|
||||
Volume::SetMountRequested(bool aMountRequested)
|
||||
{
|
||||
mMountRequested = aMountRequested;
|
||||
|
||||
LOG("SetMountRequested for volume %s to %d CanBeMounted = %d",
|
||||
NameStr(), (int)mMountRequested, (int)CanBeMounted());
|
||||
}
|
||||
|
||||
void
|
||||
Volume::SetUnmountRequested(bool aUnmountRequested)
|
||||
{
|
||||
mUnmountRequested = aUnmountRequested;
|
||||
|
||||
LOG("SetUnmountRequested for volume %s to %d CanBeMounted = %d",
|
||||
NameStr(), (int)mUnmountRequested, (int)CanBeMounted());
|
||||
}
|
||||
|
||||
void
|
||||
Volume::SetState(Volume::STATE aNewState)
|
||||
{
|
||||
@ -177,9 +197,12 @@ Volume::SetState(Volume::STATE aNewState)
|
||||
// Cover the startup case where we don't get insertion/removal events
|
||||
mMediaPresent = false;
|
||||
mIsSharing = false;
|
||||
mUnmountRequested = false;
|
||||
mMountRequested = false;
|
||||
break;
|
||||
|
||||
case nsIVolume::STATE_MOUNTED:
|
||||
mMountRequested = false;
|
||||
mIsFormatting = false;
|
||||
mIsSharing = false;
|
||||
break;
|
||||
@ -198,6 +221,8 @@ Volume::SetState(Volume::STATE aNewState)
|
||||
mIsSharing = true;
|
||||
break;
|
||||
|
||||
case nsIVolume::STATE_IDLE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -48,13 +48,18 @@ public:
|
||||
bool MediaPresent() const { return mMediaPresent; }
|
||||
bool CanBeShared() const { return mCanBeShared; }
|
||||
bool CanBeFormatted() const { return CanBeShared(); }
|
||||
bool CanBeMounted() const { return CanBeShared(); }
|
||||
bool IsSharingEnabled() const { return mCanBeShared && mSharingEnabled; }
|
||||
bool IsFormatRequested() const { return CanBeFormatted() && mFormatRequested; }
|
||||
bool IsMountRequested() const { return CanBeMounted() && mMountRequested; }
|
||||
bool IsUnmountRequested() const { return CanBeMounted() && mUnmountRequested; }
|
||||
bool IsSharing() const { return mIsSharing; }
|
||||
bool IsFormatting() const { return mIsFormatting; }
|
||||
|
||||
void SetSharingEnabled(bool aSharingEnabled);
|
||||
void SetFormatRequested(bool aFormatRequested);
|
||||
void SetMountRequested(bool aMountRequested);
|
||||
void SetUnmountRequested(bool aUnmountRequested);
|
||||
|
||||
typedef mozilla::Observer<Volume *> EventObserver;
|
||||
typedef mozilla::ObserverList<Volume *> EventObserverList;
|
||||
@ -99,6 +104,8 @@ private:
|
||||
bool mMountLocked;
|
||||
bool mSharingEnabled;
|
||||
bool mFormatRequested;
|
||||
bool mMountRequested;
|
||||
bool mUnmountRequested;
|
||||
bool mCanBeShared;
|
||||
bool mIsSharing;
|
||||
bool mIsFormatting;
|
||||
|
@ -39,6 +39,8 @@ private:
|
||||
void InitVolumeServiceIOThread(nsVolumeService* const & aVolumeService);
|
||||
void ShutdownVolumeServiceIOThread();
|
||||
void FormatVolume(const nsCString& aVolume);
|
||||
void MountVolume(const nsCString& aVolume);
|
||||
void UnmountVolume(const nsCString& aVolume);
|
||||
|
||||
} // system
|
||||
} // mozilla
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIVolumeStat.idl"
|
||||
|
||||
[scriptable, uuid(8c163fe4-5577-11e3-b3d0-10bf48d707fb)]
|
||||
[scriptable, uuid(13caa69c-8f1f-11e3-8e36-10bf48d707fb)]
|
||||
interface nsIVolume : nsISupports
|
||||
{
|
||||
// These MUST match the states from android's system/vold/Volume.h header
|
||||
@ -73,6 +73,14 @@ interface nsIVolume : nsISupports
|
||||
// Automounter will unmount it, format it and then mount it again.
|
||||
void format();
|
||||
|
||||
// Mounts the volume in IO thread, if the volume is already unmounted.
|
||||
// Automounter will mount it. Otherwise Automounter will skip this.
|
||||
void mount();
|
||||
|
||||
// Unmounts the volume in IO thread, if the volume is already mounted.
|
||||
// Automounter will unmount it. Otherwise Automounter will skip this.
|
||||
void unmount();
|
||||
|
||||
// Whether this is a fake volume.
|
||||
readonly attribute boolean isFake;
|
||||
};
|
||||
|
@ -187,6 +187,8 @@ NS_IMETHODIMP nsVolume::GetIsFake(bool *aIsFake)
|
||||
|
||||
NS_IMETHODIMP nsVolume::Format()
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(FormatVolumeIOThread, NameStr()));
|
||||
@ -197,6 +199,8 @@ NS_IMETHODIMP nsVolume::Format()
|
||||
/* static */
|
||||
void nsVolume::FormatVolumeIOThread(const nsCString& aVolume)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
|
||||
return;
|
||||
@ -205,6 +209,54 @@ void nsVolume::FormatVolumeIOThread(const nsCString& aVolume)
|
||||
AutoMounterFormatVolume(aVolume);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsVolume::Mount()
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(MountVolumeIOThread, NameStr()));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void nsVolume::MountVolumeIOThread(const nsCString& aVolume)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoMounterMountVolume(aVolume);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsVolume::Unmount()
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableFunction(UnmountVolumeIOThread, NameStr()));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void nsVolume::UnmountVolumeIOThread(const nsCString& aVolume)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoMounterUnmountVolume(aVolume);
|
||||
}
|
||||
|
||||
void
|
||||
nsVolume::LogState() const
|
||||
{
|
||||
|
@ -91,6 +91,8 @@ private:
|
||||
void SetIsFake(bool aIsFake);
|
||||
void SetState(int32_t aState);
|
||||
static void FormatVolumeIOThread(const nsCString& aVolume);
|
||||
static void MountVolumeIOThread(const nsCString& aVolume);
|
||||
static void UnmountVolumeIOThread(const nsCString& aVolume);
|
||||
|
||||
nsString mName;
|
||||
nsString mMountPoint;
|
||||
|
@ -43,6 +43,10 @@ interface DeviceStorage : EventTarget {
|
||||
DOMRequest storageStatus();
|
||||
[Throws]
|
||||
DOMRequest format();
|
||||
[Throws]
|
||||
DOMRequest mount();
|
||||
[Throws]
|
||||
DOMRequest unmount();
|
||||
|
||||
// Note that the storageName is just a name (like sdcard), and doesn't
|
||||
// include any path information.
|
||||
|
@ -110,7 +110,6 @@ Open()
|
||||
// that's double buffered with r5g6b5 format. Hence the
|
||||
// hard-coded numbers here.
|
||||
gfxImageFormat format = gfxImageFormat::RGB16_565;
|
||||
int bytesPerPixel = gfxASurface::BytePerPixelFromFormat(format);
|
||||
if (!sScreenSize) {
|
||||
sScreenSize = new gfxIntSize(sVi.xres, sVi.yres);
|
||||
}
|
||||
|
@ -37,6 +37,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LOG_TAG
|
||||
#undef LOG_TAG
|
||||
#endif
|
||||
#define LOG_TAG "HWComposer"
|
||||
|
||||
/*
|
||||
@ -64,9 +67,9 @@ namespace mozilla {
|
||||
static StaticRefPtr<HwcComposer2D> sInstance;
|
||||
|
||||
HwcComposer2D::HwcComposer2D()
|
||||
: mMaxLayerCount(0)
|
||||
: mHwc(nullptr)
|
||||
, mList(nullptr)
|
||||
, mHwc(nullptr)
|
||||
, mMaxLayerCount(0)
|
||||
, mColorFill(false)
|
||||
, mRBSwapSupport(false)
|
||||
#if ANDROID_VERSION >= 17
|
||||
|
@ -125,7 +125,7 @@ status_t GonkBufferQueue::setTransformHint(uint32_t hint) {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int GonkBufferQueue::getGeneration() {
|
||||
uint32_t GonkBufferQueue::getGeneration() {
|
||||
return mGeneration;
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ public:
|
||||
// NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0 (no transform).
|
||||
status_t setTransformHint(uint32_t hint);
|
||||
|
||||
int getGeneration();
|
||||
uint32_t getGeneration();
|
||||
|
||||
SurfaceDescriptor *getSurfaceDescriptorFromBuffer(ANativeWindowBuffer* buffer);
|
||||
|
||||
|
@ -246,7 +246,6 @@ int GonkNativeWindowClient::cancelBuffer(android_native_buffer_t* buffer,
|
||||
|
||||
int GonkNativeWindowClient::getSlotFromBufferLocked(
|
||||
android_native_buffer_t* buffer) const {
|
||||
bool dumpedState = false;
|
||||
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
|
||||
if (mSlots[i].buffer != NULL &&
|
||||
mSlots[i].buffer->handle == buffer->handle) {
|
||||
|
@ -15,7 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
@ -238,6 +240,9 @@ sendTouchEvent(UserInputData& data, bool* captured)
|
||||
case AMOTION_EVENT_ACTION_CANCEL:
|
||||
msg = NS_TOUCH_CANCEL;
|
||||
break;
|
||||
default:
|
||||
msg = NS_EVENT_NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
WidgetTouchEvent event(true, msg, nullptr);
|
||||
@ -312,7 +317,7 @@ KeyEventDispatcher::KeyEventDispatcher(const UserInputData& aData,
|
||||
{
|
||||
// XXX Printable key's keyCode value should be computed with actual
|
||||
// input character.
|
||||
mDOMKeyCode = (mData.key.keyCode < ArrayLength(kKeyMapping)) ?
|
||||
mDOMKeyCode = (mData.key.keyCode < (ssize_t)ArrayLength(kKeyMapping)) ?
|
||||
kKeyMapping[mData.key.keyCode] : 0;
|
||||
mDOMKeyNameIndex = GetKeyNameIndex(mData.key.keyCode);
|
||||
|
||||
@ -687,8 +692,14 @@ GeckoInputDispatcher::dispatchOnce()
|
||||
case AMOTION_EVENT_ACTION_UP:
|
||||
msg = NS_MOUSE_BUTTON_UP;
|
||||
break;
|
||||
default:
|
||||
msg = NS_EVENT_NULL;
|
||||
break;
|
||||
}
|
||||
if (msg != NS_EVENT_NULL) {
|
||||
sendMouseEvent(msg, data,
|
||||
status != nsEventStatus_eConsumeNoDefault);
|
||||
}
|
||||
sendMouseEvent(msg, data, status != nsEventStatus_eConsumeNoDefault);
|
||||
break;
|
||||
}
|
||||
case UserInputData::KEY_DATA: {
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
static ScreenConfiguration GetConfiguration();
|
||||
};
|
||||
|
||||
class nsScreenManagerGonk : public nsIScreenManager
|
||||
class nsScreenManagerGonk MOZ_FINAL : public nsIScreenManager
|
||||
{
|
||||
public:
|
||||
nsScreenManagerGonk();
|
||||
|
@ -143,20 +143,21 @@ APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils,
|
||||
bool scrollUpdated = false;
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, aMetrics.mScrollOffset, scrollUpdated);
|
||||
|
||||
if (scrollUpdated) {
|
||||
// Correct the display port due to the difference between mScrollOffset and the
|
||||
// actual scroll offset, possibly align it to tile boundaries (if tiled layers are
|
||||
// enabled), and clamp it to the scrollable rect.
|
||||
MaybeAlignAndClampDisplayPort(aMetrics, actualScrollOffset);
|
||||
} else {
|
||||
// For whatever reason we couldn't update the scroll offset on the scroll frame,
|
||||
// which means the data APZ used for its displayport calculation is stale. Fall
|
||||
// back to a sane default behaviour. Note that we don't tile-align the recentered
|
||||
// displayport because tile-alignment depends on the scroll position, and the
|
||||
// scroll position here is out of our control. See bug 966507 comment 21 for a
|
||||
// more detailed explanation.
|
||||
RecenterDisplayPort(aMetrics);
|
||||
if (!scrollUpdated) {
|
||||
// For whatever reason we couldn't update the scroll offset on the scroll frame,
|
||||
// which means the data APZ used for its displayport calculation is stale. Fall
|
||||
// back to a sane default behaviour. Note that we don't tile-align the recentered
|
||||
// displayport because tile-alignment depends on the scroll position, and the
|
||||
// scroll position here is out of our control. See bug 966507 comment 21 for a
|
||||
// more detailed explanation.
|
||||
RecenterDisplayPort(aMetrics);
|
||||
}
|
||||
|
||||
// Correct the display port due to the difference between mScrollOffset and the
|
||||
// actual scroll offset, possibly align it to tile boundaries (if tiled layers are
|
||||
// enabled), and clamp it to the scrollable rect.
|
||||
MaybeAlignAndClampDisplayPort(aMetrics, actualScrollOffset);
|
||||
|
||||
aMetrics.mScrollOffset = actualScrollOffset;
|
||||
|
||||
// The mZoom variable on the frame metrics stores the CSS-to-screen scale for this
|
||||
@ -214,11 +215,10 @@ APZCCallbackHelper::UpdateSubFrame(nsIContent* aContent,
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aContent);
|
||||
if (element) {
|
||||
if (scrollUpdated) {
|
||||
MaybeAlignAndClampDisplayPort(aMetrics, actualScrollOffset);
|
||||
} else {
|
||||
if (!scrollUpdated) {
|
||||
RecenterDisplayPort(aMetrics);
|
||||
}
|
||||
MaybeAlignAndClampDisplayPort(aMetrics, actualScrollOffset);
|
||||
utils->SetDisplayPortForElement(aMetrics.mDisplayPort.x,
|
||||
aMetrics.mDisplayPort.y,
|
||||
aMetrics.mDisplayPort.width,
|
||||
|
@ -972,7 +972,7 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
|
||||
mCompositorChild->Open(parentChannel, childMessageLoop, ipc::ChildSide);
|
||||
|
||||
TextureFactoryIdentifier textureFactoryIdentifier;
|
||||
PLayerTransactionChild* shadowManager;
|
||||
PLayerTransactionChild* shadowManager = nullptr;
|
||||
nsTArray<LayersBackend> backendHints;
|
||||
GetPreferredCompositorBackends(backendHints);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user