mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
6be37d8c0a
Summary: Of course, compare_exchange_strong didn't actually do what I wanted. Using a mutex is simpler and actually has the semantics we want: atomically get the current value, compare, and bail if the value is the same, or swap and continue. Changelog: [Internal] Reviewed By: shergin Differential Revision: D19754451 fbshipit-source-id: 6b0aef217b235959af683ec5e31b07a0dd7bb040
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <mutex>
|
|
|
|
#include <react/core/LayoutMetrics.h>
|
|
#include <react/core/ReactPrimitives.h>
|
|
|
|
#include "TouchEventEmitter.h"
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class ViewEventEmitter;
|
|
|
|
using SharedViewEventEmitter = std::shared_ptr<const ViewEventEmitter>;
|
|
|
|
class ViewEventEmitter : public TouchEventEmitter {
|
|
public:
|
|
using TouchEventEmitter::TouchEventEmitter;
|
|
|
|
#pragma mark - Accessibility
|
|
|
|
void onAccessibilityAction(const std::string &name) const;
|
|
void onAccessibilityTap() const;
|
|
void onAccessibilityMagicTap() const;
|
|
void onAccessibilityEscape() const;
|
|
|
|
#pragma mark - Layout
|
|
|
|
void onLayout(const LayoutMetrics &layoutMetrics) const;
|
|
|
|
private:
|
|
mutable std::mutex layoutMetricsMutex_;
|
|
mutable LayoutMetrics lastLayoutMetrics_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|