Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@ CheckOptions:
- key: readability-identifier-naming.PrivateMemberSuffix
value: "_"

# Lint headers within paths that contain "/flutter/" but not:
# - gen (generated code, the fact it compiles is good enough™)
# - third_party (we didn't author most of the code, and can't fix the lints)
# Intended to include (lint) all headers except:
# ... those in ../../gen (generated files don't need to follow clang tidy)
# ... those in flutter/third_party (we didn't author this code, it's a dep)
#
# Note this is because of our buildroot setup, so the full path of a lint is:
# "../../flutter/impeller/core/runtime_types.h:1:1" as reported.
HeaderFilterRegex: "(!third_party/)(!gen/).*/flutter/.*"
# Unfortunately Clang Tidy uses an ancient version of regular expressions
# without lookaheads, so the next best thing is to write out every directory
# except third_party.
#
# If we ever add a new root directory, we'll have to update this expression.
#
# See the test in ./tools/clang_tidy/test/header_filter_regex_test.dart which
# should theoretically catch if new directories are added but this regex is not
# updated.
#
# tl;dr: I'm sorry.
HeaderFilterRegex: "[..\/]+\/flutter\/(assets|benchmarking|build|ci|common|display_list|docs|examples|flow|flutter_frontend_server|flutter_vma|fml|impeller|lib|runtime|shell|skia|sky|testing|tools|vulkan|wasm|web_sdk)\/.*"
2 changes: 1 addition & 1 deletion impeller/renderer/vertex_buffer_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class VertexBufferBuilder {
return impeller::IndexType::kUnknown;
}

void SetLabel(std::string label) { label_ = std::move(label); }
void SetLabel(const std::string& label) { label_ = label; }

void Reserve(size_t count) { return vertices_.reserve(count); }

Expand Down
11 changes: 6 additions & 5 deletions shell/common/shell_test_platform_view_metal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
// non-Objective-C TUs.
class DarwinContextMetal {
public:
explicit DarwinContextMetal(bool impeller,
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch)
explicit DarwinContextMetal(
bool impeller,
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
: context_(impeller ? nil : [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]),
impeller_context_(impeller ? [[FlutterDarwinContextMetalImpeller alloc]
init:std::move(is_gpu_disabled_sync_switch)]
: nil),
impeller_context_(
impeller ? [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]
: nil),
offscreen_texture_(CreateOffscreenTexture(
impeller ? [impeller_context_ context]->GetMTLDevice() : [context_ device])) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ typedef enum {
// NOLINTEND(readability-identifier-naming)
} FlutterStandardCodecObjcType;

// NOLINTBEGIN(google-objc-function-naming)

///////////////////////////////////////////////////////////////////////////////
///\name Reader Helpers
///@{
Expand Down Expand Up @@ -111,6 +113,7 @@ bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data,

///@}

// NOLINTEND(google-objc-function-naming)
// NOLINTEND(google-runtime-int)

#if defined(__cplusplus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Initializes a FlutterDarwinContextMetalImpeller.
*/
- (instancetype)init:(std::shared_ptr<const fml::SyncSwitch>)is_gpu_disabled_sync_switch;
- (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch;

/**
* Creates an external texture with the specified ID and contents.
Expand Down
26 changes: 13 additions & 13 deletions shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
FLUTTER_ASSERT_ARC

static std::shared_ptr<impeller::ContextMTL> CreateImpellerContext(
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch) {
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
impeller_entity_shaders_length),
std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
impeller_entity_shaders_length),
#if IMPELLER_ENABLE_3D
std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
impeller_scene_shaders_length),
std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
impeller_scene_shaders_length),
#endif // IMPELLER_ENABLE_3D
std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
impeller_modern_shaders_length),
std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
impeller_framebuffer_blend_shaders_length),
std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
impeller_modern_shaders_length),
std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
impeller_framebuffer_blend_shaders_length),
};
auto context = impeller::ContextMTL::Create(
shader_mappings, std::move(is_gpu_disabled_sync_switch), "Impeller Library");
auto context = impeller::ContextMTL::Create(shader_mappings, is_gpu_disabled_sync_switch,
"Impeller Library");
if (!context) {
FML_LOG(ERROR) << "Could not create Metal Impeller Context.";
return nullptr;
Expand All @@ -46,10 +46,10 @@

@implementation FlutterDarwinContextMetalImpeller

- (instancetype)init:(std::shared_ptr<const fml::SyncSwitch>)is_gpu_disabled_sync_switch {
- (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch {
self = [super init];
if (self != nil) {
_context = CreateImpellerContext(std::move(is_gpu_disabled_sync_switch));
_context = CreateImpellerContext(is_gpu_disabled_sync_switch);
id<MTLDevice> device = _context->GetMTLDevice();
if (!device) {
FML_DLOG(ERROR) << "Could not acquire Metal device.";
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/darwin/ios/framework/Headers/FlutterEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ NS_ASSUME_NONNULL_BEGIN
* The dart entrypoint that is associated with `main()`. This is to be used as an argument to the
* `runWithEntrypoint*` methods.
*/
// NOLINTNEXTLINE(readability-identifier-naming)
extern NSString* const FlutterDefaultDartEntrypoint;

/**
* The default Flutter initial route ("/").
*/
// NOLINTNEXTLINE(readability-identifier-naming)
extern NSString* const FlutterDefaultInitialRoute;

/**
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject<FlutterPluginRegistry>*
* Flutter Framework (e.g. When an interact-able widget is covering the platform view).
*/
typedef enum {
// NOLINTBEGIN(readability-identifier-naming)
/**
* Flutter blocks all the UIGestureRecognizers on the platform view as soon as it
* decides they should be blocked.
Expand All @@ -266,6 +267,7 @@ typedef enum {
* but never recognizing the gesture (and never invoking actions).
*/
FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded,
// NOLINTEND(readability-identifier-naming)
} FlutterPlatformViewGestureRecognizersBlockingPolicy;

#pragma mark -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
* with the update.
*/
FLUTTER_DARWIN_EXPORT
// NOLINTNEXTLINE(readability-identifier-naming)
extern NSNotificationName const FlutterSemanticsUpdateNotification;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@

#import <Foundation/NSObject.h>
#import <UIKit/UIKit.h>

#include "fml/memory/weak_ptr.h"

#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyPrimaryResponder.h"
#import "flutter/shell/platform/embedder/embedder.h"

namespace {
typedef void* _VoidPtr;
}

typedef void (^FlutterSendKeyEvent)(const FlutterKeyEvent& /* event */,
_Nullable FlutterKeyEventCallback /* callback */,
_Nullable _VoidPtr /* user_data */);
void* _Nullable /* user_data */);

/**
* A primary responder of |FlutterKeyboardManager| that handles events by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
@interface TestKeyEvent : NSObject
@property(nonatomic) FlutterKeyEvent* data;
@property(nonatomic) FlutterKeyEventCallback callback;
@property(nonatomic) _VoidPtr userData;
@property(nonatomic) void* _Nullable userData;
- (nonnull instancetype)initWithEvent:(const FlutterKeyEvent*)event
callback:(nullable FlutterKeyEventCallback)callback
userData:(nullable _VoidPtr)userData;
userData:(void* _Nullable)userData;
- (BOOL)hasCallback;
- (void)respond:(BOOL)handled;
@end

@implementation TestKeyEvent
- (instancetype)initWithEvent:(const FlutterKeyEvent*)event
callback:(nullable FlutterKeyEventCallback)callback
userData:(nullable _VoidPtr)userData {
userData:(void* _Nullable)userData {
self = [super init];
_data = new FlutterKeyEvent(*event);
if (event->character != nullptr) {
Expand Down Expand Up @@ -132,7 +132,7 @@ - (void)testBasicKeyEvent API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -192,7 +192,7 @@ - (void)testIosKeyPlane API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -251,7 +251,7 @@ - (void)testOutOfOrderModifiers API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -350,7 +350,7 @@ - (void)testIgnoreDuplicateDownEvent API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -420,7 +420,7 @@ - (void)testIgnoreAbruptUpEvent API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -453,7 +453,7 @@ - (void)testToggleModifiersDuringKeyTap API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -541,7 +541,7 @@ - (void)testSpecialModiferFlags API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -734,7 +734,7 @@ - (void)testIdentifyLeftAndRightModifiers API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -816,7 +816,7 @@ - (void)testSynchronizeCapsLockStateOnCapsLock API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -940,7 +940,7 @@ - (void)testSynchronizeCapsLockStateOnNormalKey API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
callback:callback
userData:user_data]];
Expand Down Expand Up @@ -995,7 +995,7 @@ - (void)testCommandPeriodKey API_AVAILABLE(ios(13.4)) {

FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
_Nullable _VoidPtr user_data) {
void* _Nullable user_data) {
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event callback:nil userData:nil]];
callback(true, user_data);
}];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
FlutterTouchInterceptingView* touch_interceptor = [[[FlutterTouchInterceptingView alloc]
initWithEmbeddedView:platform_view
platformViewsController:GetWeakPtr()
gestureRecognizersBlockingPolicy:gesture_recognizers_blocking_policies[viewType]]
gestureRecognizersBlockingPolicy:gesture_recognizers_blocking_policies_[viewType]]
autorelease];

touch_interceptors_[viewId] =
Expand Down Expand Up @@ -317,7 +317,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
FML_CHECK(factories_.count(idString) == 0);
factories_[idString] =
fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>([factory retain]);
gesture_recognizers_blocking_policies[idString] = gestureRecognizerBlockingPolicy;
gesture_recognizers_blocking_policies_[idString] = gestureRecognizerBlockingPolicy;
}

void FlutterPlatformViewsController::BeginFrame(SkISize frame_size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class FlutterPlatformViewsController {

// The FlutterPlatformViewGestureRecognizersBlockingPolicy for each type of platform view.
std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
gesture_recognizers_blocking_policies;
gesture_recognizers_blocking_policies_;

bool catransaction_added_ = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@class FlutterTextInputView;

typedef NS_ENUM(NSInteger, FlutterTextInputAction) {
// NOLINTBEGIN(readability-identifier-naming)
FlutterTextInputActionUnspecified,
FlutterTextInputActionDone,
FlutterTextInputActionGo,
Expand All @@ -22,12 +23,15 @@ typedef NS_ENUM(NSInteger, FlutterTextInputAction) {
FlutterTextInputActionRoute,
FlutterTextInputActionEmergencyCall,
FlutterTextInputActionNewline,
// NOLINTEND(readability-identifier-naming)
};

typedef NS_ENUM(NSInteger, FlutterFloatingCursorDragState) {
// NOLINTBEGIN(readability-identifier-naming)
FlutterFloatingCursorDragStateStart,
FlutterFloatingCursorDragStateUpdate,
FlutterFloatingCursorDragStateEnd,
// NOLINTEND(readability-identifier-naming)
};

@protocol FlutterTextInputDelegate <NSObject>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewResponder.h"

typedef NS_ENUM(NSInteger, FlutterScribbleFocusStatus) {
// NOLINTBEGIN(readability-identifier-naming)
FlutterScribbleFocusStatusUnfocused,
FlutterScribbleFocusStatusFocusing,
FlutterScribbleFocusStatusFocused,
// NOLINTEND(readability-identifier-naming)
};

typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
// NOLINTBEGIN(readability-identifier-naming)
FlutterScribbleInteractionStatusNone,
FlutterScribbleInteractionStatusStarted,
FlutterScribbleInteractionStatusEnding,
// NOLINTEND(readability-identifier-naming)
};

@interface FlutterTextInputPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, FlutterUndoRedoDirection) {
// NOLINTBEGIN(readability-identifier-naming)
FlutterUndoRedoDirectionUndo,
FlutterUndoRedoDirectionRedo,
// NOLINTEND(readability-identifier-naming)
};

@class FlutterUndoManagerPlugin;
Expand Down
Loading