summaryrefslogtreecommitdiff
path: root/jni/node-inl.h
diff options
context:
space:
mode:
author Biswarup Pal <biswarupp@google.com> 2021-02-15 13:39:36 +0000
committer Biswarup Pal <biswarupp@google.com> 2021-02-22 19:39:25 +0000
commit93f4ec14166422b980a3d2535e8fb368936cba4d (patch)
tree28168df7bb4af7d3462f8c3c37ba33ff7d2f9697 /jni/node-inl.h
parent2ed0cd05470c6328c5b484f7599235120d3bb819 (diff)
Implement MediaProvider#getOriginalMediaFormatFileDescriptor
Test: TranscodeTest Bug: 170488060 Change-Id: I74e9e0de58a2b6283ddc1a485f5aecfcfd9eb609
Diffstat (limited to 'jni/node-inl.h')
-rw-r--r--jni/node-inl.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/jni/node-inl.h b/jni/node-inl.h
index 8a974966d..9b30e8742 100644
--- a/jni/node-inl.h
+++ b/jni/node-inl.h
@@ -19,6 +19,7 @@
#include <android-base/logging.h>
+#include <sys/types.h>
#include <atomic>
#include <cstdint>
#include <limits>
@@ -127,24 +128,24 @@ class node {
// Creates a new node with the specified parent, name and lock.
static node* Create(node* parent, const std::string& name, const std::string& io_path,
bool should_invalidate, bool transforms_complete, const int transforms,
- const int transforms_reason, std::recursive_mutex* lock,
+ const int transforms_reason, std::recursive_mutex* lock, ino_t ino,
NodeTracker* tracker) {
// Place the entire constructor under a critical section to make sure
// node creation, tracking (if enabled) and the addition to a parent are
// atomic.
std::lock_guard<std::recursive_mutex> guard(*lock);
return new node(parent, name, io_path, should_invalidate, transforms_complete, transforms,
- transforms_reason, lock, tracker);
+ transforms_reason, lock, ino, tracker);
}
// Creates a new root node. Root nodes have no parents by definition
// and their "name" must signify an absolute path.
- static node* CreateRoot(const std::string& path, std::recursive_mutex* lock,
+ static node* CreateRoot(const std::string& path, std::recursive_mutex* lock, ino_t ino,
NodeTracker* tracker) {
std::lock_guard<std::recursive_mutex> guard(*lock);
node* root = new node(nullptr, path, path, false /* should_invalidate */,
true /* transforms_complete */, 0 /* transforms */,
- 0 /* transforms_reason */, lock, tracker);
+ 0 /* transforms_reason */, lock, ino, tracker);
// The root always has one extra reference to avoid it being
// accidentally collected.
@@ -358,10 +359,13 @@ class node {
// through the hierarchy exists.
static const node* LookupAbsolutePath(const node* root, const std::string& absolute_path);
+ // Looks up for the node with the given ino rooted at |root|, or nullptr if no such node exists.
+ static const node* LookupInode(const node* root, ino_t ino);
+
private:
node(node* parent, const std::string& name, const std::string& io_path,
const bool should_invalidate, const bool transforms_complete, const int transforms,
- const int transforms_reason, std::recursive_mutex* lock, NodeTracker* tracker)
+ const int transforms_reason, std::recursive_mutex* lock, ino_t ino, NodeTracker* tracker)
: name_(name),
io_path_(io_path),
transforms_complete_(transforms_complete),
@@ -373,6 +377,7 @@ class node {
should_invalidate_(should_invalidate),
deleted_(false),
lock_(lock),
+ ino_(ino),
tracker_(tracker) {
tracker_->NodeCreated(this);
Acquire();
@@ -526,6 +531,8 @@ class node {
bool should_invalidate_;
bool deleted_;
std::recursive_mutex* lock_;
+ // Inode number of the file represented by this node.
+ const ino_t ino_;
NodeTracker* const tracker_;