mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary:To support native modules in web workers, native modules need to have an notion of the JS executor/thread that called into them in order to respond via Callback or JS module call to the right executor on the right thread. ExecutorToken is an object that only serves as a token that can be used to identify an executor/message queue thread in the bridge. It doesn't expose any methods. Native modules Callback objects automatically have this ExecutionContext attached -- JSModule calls for modules that support workers will need to supply an appropriate ExecutorToken when retrieving the JSModule implementation from the ReactContext. Reviewed By: mhorowitz Differential Revision: D2965458 fb-gh-sync-id: 6e354d4df8536d40b12d02bd055f6d06b4ca595d shipit-source-id: 6e354d4df8536d40b12d02bd055f6d06b4ca595d
26 lines
448 B
C++
26 lines
448 B
C++
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "ExecutorToken.h"
|
|
#include "Executor.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
/**
|
|
* Class that knows how to create the platform-specific implementation
|
|
* of ExecutorToken.
|
|
*/
|
|
class ExecutorTokenFactory {
|
|
public:
|
|
virtual ~ExecutorTokenFactory() {}
|
|
|
|
/**
|
|
* Creates a new ExecutorToken.
|
|
*/
|
|
virtual ExecutorToken createExecutorToken() const = 0;
|
|
};
|
|
|
|
} }
|