Bug 1183959 - Move FlushPendingFileDeletions() from PContent to PBackground; r=khuey

This commit is contained in:
Jan Varga 2016-02-10 16:11:25 +01:00
Родитель fb7fb37fd7
Коммит 9b4516ad03
10 изменённых файлов: 63 добавлений и 33 удалений

Просмотреть файл

@ -8566,6 +8566,16 @@ private:
NS_DECL_NSIRUNNABLE
};
class FlushPendingFileDeletionsRunnable final
: public nsRunnable
{
private:
~FlushPendingFileDeletionsRunnable()
{ }
NS_DECL_NSIRUNNABLE
};
class PermissionRequestHelper final
: public PermissionRequestBase
, public PIndexedDBPermissionRequestParent
@ -9568,6 +9578,19 @@ DeallocPBackgroundIndexedDBUtilsParent(PBackgroundIndexedDBUtilsParent* aActor)
return true;
}
bool
RecvFlushPendingFileDeletions()
{
AssertIsOnBackgroundThread();
RefPtr<FlushPendingFileDeletionsRunnable> runnable =
new FlushPendingFileDeletionsRunnable();
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
return true;
}
PIndexedDBPermissionRequestParent*
AllocPIndexedDBPermissionRequestParent(Element* aOwnerElement,
nsIPrincipal* aPrincipal)
@ -27062,6 +27085,24 @@ GetFileReferencesHelper::Run()
return NS_OK;
}
NS_IMETHODIMP
FlushPendingFileDeletionsRunnable::Run()
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<IndexedDatabaseManager> mgr = IndexedDatabaseManager::Get();
if (NS_WARN_IF(!mgr)) {
return NS_ERROR_FAILURE;
}
nsresult rv = mgr->FlushPendingFileDeletions();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
void
PermissionRequestHelper::OnPromptComplete(PermissionValue aPermissionValue)
{

Просмотреть файл

@ -45,6 +45,9 @@ AllocPBackgroundIndexedDBUtilsParent();
bool
DeallocPBackgroundIndexedDBUtilsParent(PBackgroundIndexedDBUtilsParent* aActor);
bool
RecvFlushPendingFileDeletions();
PIndexedDBPermissionRequestParent*
AllocPIndexedDBPermissionRequestParent(Element* aOwnerElement,
nsIPrincipal* aPrincipal);

Просмотреть файл

@ -22,7 +22,6 @@
#include "mozilla/EventDispatcher.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DOMError.h"
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/ErrorEventBinding.h"
@ -934,12 +933,12 @@ IndexedDatabaseManager::FlushPendingFileDeletions()
return rv;
}
} else {
ContentChild* contentChild = ContentChild::GetSingleton();
if (NS_WARN_IF(!contentChild)) {
PBackgroundChild* bgActor = BackgroundChild::GetForCurrentThread();
if (NS_WARN_IF(!bgActor)) {
return NS_ERROR_FAILURE;
}
if (!contentChild->SendFlushPendingFileDeletions()) {
if (!bgActor->SendFlushPendingFileDeletions()) {
return NS_ERROR_FAILURE;
}
}

Просмотреть файл

@ -182,7 +182,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
[test_file_delete.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
[test_file_os_delete.html]
skip-if = e10s || (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116, Bug 1183959 for e10s
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
[test_file_put_get_object.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
[test_file_put_get_values.html]

Просмотреть файл

@ -64,7 +64,6 @@
#include "mozilla/dom/cellbroadcast/CellBroadcastParent.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
#include "mozilla/dom/icc/IccParent.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
#include "mozilla/dom/mobileconnection/MobileConnectionParent.h"
#include "mozilla/dom/mobilemessage/SmsParent.h"
#include "mozilla/dom/power/PowerManagerService.h"
@ -291,7 +290,6 @@ using namespace mozilla::dom::bluetooth;
using namespace mozilla::dom::cellbroadcast;
using namespace mozilla::dom::devicestorage;
using namespace mozilla::dom::icc;
using namespace mozilla::dom::indexedDB;
using namespace mozilla::dom::power;
using namespace mozilla::dom::mobileconnection;
using namespace mozilla::dom::mobilemessage;
@ -5109,26 +5107,6 @@ ContentParent::DeallocPFileDescriptorSetParent(PFileDescriptorSetParent* aActor)
return true;
}
bool
ContentParent::RecvFlushPendingFileDeletions()
{
RefPtr<IndexedDatabaseManager> mgr = IndexedDatabaseManager::Get();
if (NS_WARN_IF(!mgr)) {
return false;
}
if (NS_WARN_IF(!mgr->IsMainProcess())) {
return false;
}
nsresult rv = mgr->FlushPendingFileDeletions();
if (NS_WARN_IF(NS_FAILED(rv))) {
return false;
}
return true;
}
bool
ContentParent::IgnoreIPCPrincipal()
{

Просмотреть файл

@ -1045,9 +1045,6 @@ private:
virtual bool
DeallocPFileDescriptorSetParent(PFileDescriptorSetParent*) override;
virtual bool
RecvFlushPendingFileDeletions() override;
virtual PWebrtcGlobalParent* AllocPWebrtcGlobalParent() override;
virtual bool DeallocPWebrtcGlobalParent(PWebrtcGlobalParent *aActor) override;

Просмотреть файл

@ -1055,9 +1055,6 @@ parent:
sync KeygenProvideContent()
returns (nsString aAttribute, nsString[] aContent);
// Use only for testing!
async FlushPendingFileDeletions();
/**
* Tell the chrome process there is an creation of PBrowser.
* return a system-wise unique Id.

Просмотреть файл

@ -217,6 +217,15 @@ BackgroundParentImpl::DeallocPBackgroundIndexedDBUtilsParent(
mozilla::dom::indexedDB::DeallocPBackgroundIndexedDBUtilsParent(aActor);
}
bool
BackgroundParentImpl::RecvFlushPendingFileDeletions()
{
AssertIsInMainProcess();
AssertIsOnBackgroundThread();
return mozilla::dom::indexedDB::RecvFlushPendingFileDeletions();
}
auto
BackgroundParentImpl::AllocPBlobParent(const BlobConstructorParams& aParams)
-> PBlobParent*

Просмотреть файл

@ -58,6 +58,9 @@ protected:
PBackgroundIndexedDBUtilsParent* aActor)
override;
virtual bool
RecvFlushPendingFileDeletions() override;
virtual PBlobParent*
AllocPBlobParent(const BlobConstructorParams& aParams) override;

Просмотреть файл

@ -66,6 +66,9 @@ parent:
async PBackgroundIndexedDBUtils();
// Use only for testing!
async FlushPendingFileDeletions();
async PVsync();
async PCameras();