-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[0.72] Implement BlobCollector (#12275)
* Implement BlobCollector (#12269) * Implement BlobCollector * Change files * clang format * Remove change files * Change files
- Loading branch information
1 parent
eb9cc55
commit 36fc7ba
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/react-native-windows-8036b88d-3957-4d10-a466-ae3f555f4e5a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Implement BlobCollector (#12269)", | ||
"packageName": "react-native-windows", | ||
"email": "julio.rocha@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
#include "BlobCollector.h" | ||
|
||
using std::string; | ||
|
||
namespace Microsoft::React { | ||
|
||
using Networking::IBlobResource; | ||
|
||
BlobCollector::BlobCollector(string blobId, std::shared_ptr<IBlobResource> resource) noexcept | ||
: m_blobId{blobId}, m_weakResource{std::weak_ptr<IBlobResource>(resource)} {} | ||
|
||
BlobCollector::~BlobCollector() noexcept { | ||
if (auto rc = m_weakResource.lock()) { | ||
rc->Release(std::move(m_blobId)); | ||
} | ||
} | ||
|
||
} // namespace Microsoft::React |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
#pragma once | ||
|
||
#include <Networking/IBlobResource.h> | ||
|
||
// JSI | ||
#include <jsi/jsi.h> | ||
|
||
namespace Microsoft::React { | ||
|
||
class JSI_EXPORT BlobCollector : public facebook::jsi::HostObject { | ||
std::string m_blobId; | ||
std::weak_ptr<Networking::IBlobResource> m_weakResource; | ||
|
||
public: | ||
BlobCollector(std::string blobId, std::shared_ptr<Networking::IBlobResource> resource) noexcept; | ||
|
||
~BlobCollector() noexcept; | ||
}; | ||
|
||
} // namespace Microsoft::React |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters