mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 12:25:59 +08:00
Build new bridge with gradle
Reviewed By: bestander Differential Revision: D3324351 fbshipit-source-id: 41fa18a23c8661440a7deff244c93278f418e1d9
This commit is contained in:
committed by
Facebook Github Bot 9
parent
708530a905
commit
5e8f1716fc
54
ReactCommon/cxxreact/ExecutorToken.h
Normal file
54
ReactCommon/cxxreact/ExecutorToken.h
Normal file
@@ -0,0 +1,54 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Executor.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/**
|
||||
* This class exists so that we have a type for the shared_ptr on ExecutorToken
|
||||
* that implements a virtual destructor.
|
||||
*/
|
||||
class PlatformExecutorToken {
|
||||
public:
|
||||
virtual ~PlatformExecutorToken() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Class corresponding to a JS VM that can call into native modules. This is
|
||||
* passed to native modules to allow their JS module calls/callbacks to be
|
||||
* routed back to the proper JS VM on the proper thread.
|
||||
*/
|
||||
class ExecutorToken {
|
||||
public:
|
||||
/**
|
||||
* This should only be used by the implementation of the platform ExecutorToken.
|
||||
* Do not use as a client of ExecutorToken.
|
||||
*/
|
||||
explicit ExecutorToken(std::shared_ptr<PlatformExecutorToken> platformToken) :
|
||||
platformToken_(platformToken) {}
|
||||
|
||||
std::shared_ptr<PlatformExecutorToken> getPlatformExecutorToken() const {
|
||||
return platformToken_;
|
||||
}
|
||||
|
||||
bool operator==(const ExecutorToken& other) const {
|
||||
return platformToken_.get() == other.platformToken_.get();
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<PlatformExecutorToken> platformToken_;
|
||||
};
|
||||
|
||||
} }
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<facebook::react::ExecutorToken> {
|
||||
const size_t operator()(const facebook::react::ExecutorToken& token) const {
|
||||
return (size_t) token.getPlatformExecutorToken().get();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user