Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move TaskQueueType to its own file
  • Loading branch information
stuartmorgan-g committed Feb 14, 2025
commit 7a2acebbef940301b23890a31b782be2756df51e
2 changes: 1 addition & 1 deletion packages/pigeon/lib/src/java/java_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show TaskQueueType;
import '../types/task_queue.dart';

/// Documentation open symbol.
const String _docCommentPrefix = '/**';
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/src/kotlin/kotlin_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show TaskQueueType;
import '../types/task_queue.dart';
import 'templates.dart';

/// Documentation open symbol.
Expand Down
3 changes: 2 additions & 1 deletion packages/pigeon/lib/src/objc/objc_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show Error, TaskQueueType;
import '../pigeon_lib.dart' show Error;
import '../types/task_queue.dart';

/// Documentation comment open symbol.
const String _docCommentPrefix = '///';
Expand Down
18 changes: 3 additions & 15 deletions packages/pigeon/lib/src/pigeon_lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ import 'java/java_generator.dart';
import 'kotlin/kotlin_generator.dart';
import 'objc/objc_generator.dart';
import 'swift/swift_generator.dart';
import 'types/task_queue.dart';

export 'types/task_queue.dart' show TaskQueueType;

class _Asynchronous {
const _Asynchronous();
Expand Down Expand Up @@ -211,21 +214,6 @@ class SwiftClass {
const SwiftClass();
}

/// Type of TaskQueue which determines how handlers are dispatched for
/// HostApi's.
enum TaskQueueType {
/// Handlers are invoked serially on the default thread. This is the value if
/// unspecified.
serial,

/// Handlers are invoked serially on a background thread.
serialBackgroundThread,

// TODO(gaaclarke): Add support for concurrent task queues.
// /// Handlers are invoked concurrently on a background thread.
// concurrentBackgroundThread,
}

/// Metadata annotation to control how handlers are dispatched for HostApi's.
/// Note that the TaskQueue API might not be available on the target version of
/// Flutter, see also:
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/src/swift/swift_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart';
import '../types/task_queue.dart';
import 'templates.dart';

/// Documentation comment open symbol.
Expand Down
18 changes: 18 additions & 0 deletions packages/pigeon/lib/src/types/task_queue.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Type of TaskQueue which determines how handlers are dispatched for
/// HostApi's.
enum TaskQueueType {
/// Handlers are invoked serially on the default thread. This is the value if
/// unspecified.
serial,

/// Handlers are invoked serially on a background thread.
serialBackgroundThread,

// TODO(gaaclarke): Add support for concurrent task queues.
// /// Handlers are invoked concurrently on a background thread.
// concurrentBackgroundThread,
}