Skip to content
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
18 changes: 8 additions & 10 deletions dev/integration_tests/channels/ios/Runner/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,38 +86,36 @@ @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
FlutterViewController *flutterController =
(FlutterViewController *)self.window.rootViewController;

id<FlutterPluginRegistrar> registrar = [self registrarForPlugin:@"platform-channel-test"];
ExtendedReaderWriter* extendedReaderWriter = [ExtendedReaderWriter new];
[self setupMessagingHandshakeOnChannel:
[FlutterBasicMessageChannel messageChannelWithName:@"binary-msg"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterBinaryCodec sharedInstance]]];
[self setupMessagingHandshakeOnChannel:
[FlutterBasicMessageChannel messageChannelWithName:@"string-msg"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterStringCodec sharedInstance]]];
[self setupMessagingHandshakeOnChannel:
[FlutterBasicMessageChannel messageChannelWithName:@"json-msg"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterJSONMessageCodec sharedInstance]]];
[self setupMessagingHandshakeOnChannel:
[FlutterBasicMessageChannel messageChannelWithName:@"std-msg"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterStandardMessageCodec codecWithReaderWriter:extendedReaderWriter]]];
[self setupMethodCallSuccessHandshakeOnChannel:
[FlutterMethodChannel methodChannelWithName:@"json-method"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterJSONMethodCodec sharedInstance]]];
[self setupMethodCallSuccessHandshakeOnChannel:
[FlutterMethodChannel methodChannelWithName:@"std-method"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterStandardMethodCodec codecWithReaderWriter:extendedReaderWriter]]];

[[FlutterBasicMessageChannel
messageChannelWithName:@"std-echo"
binaryMessenger:flutterController
binaryMessenger:registrar.messenger
codec:[FlutterStandardMessageCodec
codecWithReaderWriter:extendedReaderWriter]]
setMessageHandler:^(id message, FlutterReply reply) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0D569A532DDF895D00F24F69 /* TextureViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D569A522DDF895D00F24F69 /* TextureViewController.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
Expand All @@ -28,6 +29,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0D569A522DDF895D00F24F69 /* TextureViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextureViewController.m; sourceTree = "<group>"; };
0D569A542DDF896B00F24F69 /* TextureViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextureViewController.h; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -89,6 +92,8 @@
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
0D569A522DDF895D00F24F69 /* TextureViewController.m */,
0D569A542DDF896B00F24F69 /* TextureViewController.h */,
);
path = Runner;
sourceTree = "<group>";
Expand Down Expand Up @@ -210,6 +215,7 @@
files = (
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
97C146F31CF9000F007C117D /* main.m in Sources */,
0D569A532DDF895D00F24F69 /* TextureViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -281,9 +287,13 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.externalUi;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand Down Expand Up @@ -382,9 +392,13 @@
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.externalUi;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand All @@ -395,9 +409,13 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = io.flutter.externalUi;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>

@interface AppDelegate : FlutterAppDelegate<FlutterTexture>

@interface AppDelegate : FlutterAppDelegate
@end
68 changes: 0 additions & 68 deletions dev/integration_tests/external_textures/ios/Runner/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,5 @@

#import "AppDelegate.h"

@interface AppDelegate ()
@property (atomic) uint64_t textureId;
@property (atomic) int framesProduced;
@property (atomic) int framesConsumed;
@property (atomic) int lastFrameConsumed;
@property (atomic) double startTime;
@property (atomic) double endTime;
@property (atomic) double frameRate;
@property (atomic) double frameStartTime;
@property (atomic) NSTimer* timer;

- (void)tick:(NSTimer*)timer;
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
FlutterViewController* flutterController =
(FlutterViewController*)self.window.rootViewController;
FlutterMethodChannel* channel =
[FlutterMethodChannel methodChannelWithName:@"texture"
binaryMessenger:flutterController];
[channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
if ([@"start" isEqualToString:call.method]) {
_framesProduced = 0;
_framesConsumed = 0;
_frameRate = 1.0 / [(NSNumber*) call.arguments intValue];
_timer = [NSTimer scheduledTimerWithTimeInterval:_frameRate
target:self
selector:@selector(tick:)
userInfo:nil
repeats:YES];
_startTime = [[NSDate date] timeIntervalSince1970];
result(nil);
} else if ([@"stop" isEqualToString:call.method]) {
[_timer invalidate];
_endTime = [[NSDate date] timeIntervalSince1970];
result(nil);
} else if ([@"getProducedFrameRate" isEqualToString:call.method]) {
result(@(_framesProduced / (_endTime - _startTime)));
} else if ([@"getConsumedFrameRate" isEqualToString:call.method]) {
result(@(_framesConsumed / (_endTime - _startTime)));
} else {
result(FlutterMethodNotImplemented);
}
}];
_textureId = [flutterController registerTexture:self];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (void)tick:(NSTimer*)timer {
FlutterViewController* flutterController =
(FlutterViewController*)self.window.rootViewController;
[flutterController textureFrameAvailable:_textureId];
_frameStartTime = [[NSDate date] timeIntervalSince1970];
// We just pretend to be producing a frame.
_framesProduced++;
}

- (CVPixelBufferRef)copyPixelBuffer {
double now = [[NSDate date] timeIntervalSince1970];
if (now < _frameStartTime
|| _frameStartTime + _frameRate < now
|| _framesProduced == _lastFrameConsumed) return nil;
_framesConsumed++;
_lastFrameConsumed = _framesProduced;
// We just pretend to be handing over the produced frame to the consumer.
return nil;
}
@end
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<!--Texture View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="TextureViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="132" y="-34"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2014 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.

#import <Flutter/Flutter.h>

@interface TextureViewController : FlutterViewController
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2014 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.

#import "TextureViewController.h"
#import "AppDelegate.h"

@interface TextureViewController () <FlutterTexture>
@property (nonatomic, assign) uint64_t textureId;
@property (nonatomic, assign) int framesProduced;
@property (nonatomic, assign) int framesConsumed;
@property (nonatomic, assign) int lastFrameConsumed;
@property (nonatomic, assign) double startTime;
@property (nonatomic, assign) double endTime;
@property (nonatomic, assign) double frameRate;
@property (nonatomic, assign) double frameStartTime;
@property (nonatomic, strong) NSTimer* timer;
- (void)tick:(NSTimer*)timer;
@end

@implementation TextureViewController

- (void)awakeFromNib {
[super awakeFromNib];

FlutterMethodChannel* channel =
[FlutterMethodChannel methodChannelWithName:@"texture"
binaryMessenger:self.binaryMessenger];
[channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
if ([@"start" isEqualToString:call.method]) {
_framesProduced = 0;
_framesConsumed = 0;
_frameRate = 1.0 / [(NSNumber*) call.arguments intValue];
_timer = [NSTimer scheduledTimerWithTimeInterval:_frameRate
target:self
selector:@selector(tick:)
userInfo:nil
repeats:YES];
_startTime = [[NSDate date] timeIntervalSince1970];
result(nil);
} else if ([@"stop" isEqualToString:call.method]) {
[_timer invalidate];
_endTime = [[NSDate date] timeIntervalSince1970];
result(nil);
} else if ([@"getProducedFrameRate" isEqualToString:call.method]) {
result(@(_framesProduced / (_endTime - _startTime)));
} else if ([@"getConsumedFrameRate" isEqualToString:call.method]) {
result(@(_framesConsumed / (_endTime - _startTime)));
} else {
result(FlutterMethodNotImplemented);
}
}];

_textureId = [self registerTexture:self];
}

- (void)tick:(NSTimer*)timer {
[self textureFrameAvailable:_textureId];
_frameStartTime = [[NSDate date] timeIntervalSince1970];
// We just pretend to be producing a frame.
_framesProduced++;
}

- (CVPixelBufferRef)copyPixelBuffer {
double now = [[NSDate date] timeIntervalSince1970];
if (now < _frameStartTime
|| _frameStartTime + _frameRate < now
|| _framesProduced == _lastFrameConsumed) return nil;
_framesConsumed++;
_lastFrameConsumed = _framesProduced;
// We just pretend to be handing over the produced frame to the consumer.
return nil;
}

@end
8 changes: 8 additions & 0 deletions engine/src/flutter/ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -52778,6 +52778,7 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/ConnectionCo
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FakeUIPressProxy.swift + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Test.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h + ../../../flutter/LICENSE
Expand Down Expand Up @@ -52808,6 +52809,9 @@ ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeySe
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterLaunchEngine.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterLaunchEngine.m + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterLaunchEngineTest.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayerTest.mm + ../../../flutter/LICENSE
Expand Down Expand Up @@ -55804,6 +55808,7 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/ConnectionColl
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FakeUIPressProxy.swift
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Internal.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Test.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache_Internal.h
Expand Down Expand Up @@ -55834,6 +55839,9 @@ FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeySeco
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManager.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterLaunchEngine.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterLaunchEngine.m
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterLaunchEngineTest.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayerTest.mm
Expand Down
Loading