Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "PendingIPCBlobChild.h"
8 :
9 : namespace mozilla {
10 : namespace dom {
11 :
12 0 : PendingIPCBlobChild::PendingIPCBlobChild(const IPCBlob& aBlob)
13 : {
14 0 : mBlobImpl = IPCBlobUtils::Deserialize(aBlob);
15 0 : MOZ_ASSERT(mBlobImpl);
16 0 : }
17 :
18 0 : PendingIPCBlobChild::~PendingIPCBlobChild()
19 0 : {}
20 :
21 : already_AddRefed<BlobImpl>
22 0 : PendingIPCBlobChild::SetPendingInfoAndDeleteActor(const nsString& aName,
23 : const nsString& aContentType,
24 : uint64_t aLength,
25 : int64_t aLastModifiedDate)
26 : {
27 0 : RefPtr<BlobImpl> blobImpl;
28 0 : blobImpl.swap(mBlobImpl);
29 :
30 0 : blobImpl->SetLazyData(aName, aContentType, aLength, aLastModifiedDate);
31 :
32 0 : PendingIPCFileData fileData(nsString(aName), aLastModifiedDate);
33 0 : PendingIPCBlobData blobData(nsString(aContentType), aLength, fileData);
34 0 : Unused << Send__delete__(this, blobData);
35 :
36 0 : return blobImpl.forget();
37 : }
38 :
39 : already_AddRefed<BlobImpl>
40 0 : PendingIPCBlobChild::SetPendingInfoAndDeleteActor(const nsString& aContentType,
41 : uint64_t aLength)
42 : {
43 0 : RefPtr<BlobImpl> blobImpl;
44 0 : blobImpl.swap(mBlobImpl);
45 :
46 0 : blobImpl->SetLazyData(NullString(), aContentType, aLength, INT64_MAX);
47 :
48 0 : PendingIPCBlobData data(nsString(aContentType), aLength, void_t());
49 0 : Unused << Send__delete__(this, data);
50 :
51 0 : return blobImpl.forget();
52 : }
53 :
54 : } // namespace dom
55 : } // namespace mozilla
|