Remove unused services (flutter/engine#3128)

The platform use cases are handled by the PlatformPlugin. The media service and
the sensor service have no clients. If we want to use them, we should create
plugins for them.
This commit is contained in:
Adam Barth
2016-10-13 12:14:38 -07:00
committed by GitHub
parent 04a38139ad
commit d7e000f83e
18 changed files with 30 additions and 189 deletions

View File

@@ -86,19 +86,14 @@ android_library("java") {
"//flutter/services/editing:editing_lib",
"//flutter/services/editing:interfaces_java",
"//flutter/services/engine:interfaces_java",
"//flutter/services/media:interfaces_java",
"//flutter/services/media:media_lib",
"//flutter/services/platform:interfaces_java",
"//flutter/services/platform:platform_lib",
"//flutter/services/raw_keyboard:interfaces_java",
"//flutter/services/raw_keyboard:raw_keyboard_lib",
"//flutter/services/sensors:sensors_lib",
"//flutter/services/vsync:vsync_lib",
"//mojo/android:system_java",
"//mojo/public/interfaces/application:application_java",
"//mojo/public/java:bindings",
"//mojo/public/java:system",
"//mojo/services/sensors/interfaces:interfaces_java",
"//mojo/services/vsync/interfaces:interfaces_java",
]
}

View File

@@ -31,28 +31,14 @@ import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.library_loader.LibraryProcessType;
import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.mojo.bindings.Interface.Binding;
import org.chromium.mojo.sensors.SensorServiceImpl;
import org.chromium.mojo.system.Core;
import org.chromium.mojo.system.impl.CoreImpl;
import org.chromium.mojo.system.MessagePipeHandle;
import org.chromium.mojom.activity.Activity;
import org.chromium.mojom.editing.Clipboard;
import org.chromium.mojom.flutter.platform.HapticFeedback;
import org.chromium.mojom.flutter.platform.PathProvider;
import org.chromium.mojom.flutter.platform.SystemChrome;
import org.chromium.mojom.flutter.platform.SystemSound;
import org.chromium.mojom.flutter.platform.UrlLauncher;
import org.chromium.mojom.media.MediaService;
import org.chromium.mojom.sensors.SensorService;
import org.chromium.mojom.vsync.VSyncProvider;
import org.domokit.activity.ActivityImpl;
import org.domokit.editing.ClipboardImpl;
import org.domokit.media.MediaServiceImpl;
import org.domokit.platform.HapticFeedbackImpl;
import org.domokit.platform.PathProviderImpl;
import org.domokit.platform.SystemChromeImpl;
import org.domokit.platform.SystemSoundImpl;
import org.domokit.platform.UrlLauncherImpl;
import org.domokit.vsync.VSyncProviderImpl;
/**
@@ -212,63 +198,12 @@ public class FlutterMain {
}
});
registry.register(MediaService.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return MediaService.MANAGER.bind(new MediaServiceImpl(view.getContext(), core), pipe);
}
});
registry.register(SensorService.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return SensorService.MANAGER.bind(new SensorServiceImpl(view.getContext()), pipe);
}
});
registry.register(VSyncProvider.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return VSyncProvider.MANAGER.bind(new VSyncProviderImpl(pipe), pipe);
}
});
registry.register(HapticFeedback.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return HapticFeedback.MANAGER.bind(new HapticFeedbackImpl((android.app.Activity) view.getContext()), pipe);
}
});
registry.register(PathProvider.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return PathProvider.MANAGER.bind(new PathProviderImpl(view.getContext()), pipe);
}
});
registry.register(SystemChrome.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
SystemChromeImpl chrome = new SystemChromeImpl((android.app.Activity) view.getContext());
view.addActivityLifecycleListener(chrome);
return SystemChrome.MANAGER.bind(chrome, pipe);
}
});
registry.register(SystemSound.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return SystemSound.MANAGER.bind(new SystemSoundImpl((android.app.Activity) view.getContext()), pipe);
}
});
registry.register(UrlLauncher.MANAGER.getName(), new ServiceFactory() {
@Override
public Binding connectToService(FlutterView view, Core core, MessagePipeHandle pipe) {
return UrlLauncher.MANAGER.bind(new UrlLauncherImpl((android.app.Activity) view.getContext()), pipe);
}
});
}
/**

View File

@@ -24,7 +24,6 @@ source_set("common") {
"//flutter/services/activity",
"//flutter/services/editing",
"//flutter/services/engine:interfaces",
"//flutter/services/media",
"//flutter/services/platform",
"//flutter/services/vsync",
"//flutter/shell/common",

View File

@@ -7,13 +7,6 @@
#if TARGET_OS_IPHONE
#include "flutter/services/activity/ios/activity_impl.h"
#include "flutter/services/editing/ios/clipboard_impl.h"
#include "flutter/services/media/ios/media_player_impl.h"
#include "flutter/services/media/ios/media_service_impl.h"
#include "flutter/services/platform/ios/haptic_feedback_impl.h"
#include "flutter/services/platform/ios/path_provider_impl.h"
#include "flutter/services/platform/ios/system_chrome_impl.h"
#include "flutter/services/platform/ios/system_sound_impl.h"
#include "flutter/services/platform/ios/url_launcher_impl.h"
#include "flutter/services/vsync/ios/vsync_provider_ios_impl.h"
#else
#include "flutter/services/vsync/mac/vsync_provider_mac_impl.h"
@@ -31,16 +24,6 @@ void PlatformServiceProvider::ConnectToService(
const mojo::String& service_name,
mojo::ScopedMessagePipeHandle client_handle) {
#if TARGET_OS_IPHONE
if (service_name == ::media::MediaPlayer::Name_) {
new sky::services::media::MediaPlayerImpl(
mojo::InterfaceRequest<::media::MediaPlayer>(client_handle.Pass()));
return;
}
if (service_name == ::media::MediaService::Name_) {
new sky::services::media::MediaServiceImpl(
mojo::InterfaceRequest<::media::MediaService>(client_handle.Pass()));
return;
}
if (service_name == ::activity::Activity::Name_) {
new sky::services::activity::ActivityImpl(
mojo::InterfaceRequest<::activity::Activity>(client_handle.Pass()));
@@ -51,36 +34,6 @@ void PlatformServiceProvider::ConnectToService(
mojo::InterfaceRequest<::editing::Clipboard>(client_handle.Pass()));
return;
}
if (service_name == flutter::platform::HapticFeedback::Name_) {
new flutter::platform::HapticFeedbackImpl(
mojo::InterfaceRequest<flutter::platform::HapticFeedback>(
client_handle.Pass()));
return;
}
if (service_name == flutter::platform::PathProvider::Name_) {
new flutter::platform::PathProviderImpl(
mojo::InterfaceRequest<flutter::platform::PathProvider>(
client_handle.Pass()));
return;
}
if (service_name == flutter::platform::SystemChrome::Name_) {
new flutter::platform::SystemChromeImpl(
mojo::InterfaceRequest<flutter::platform::SystemChrome>(
client_handle.Pass()));
return;
}
if (service_name == flutter::platform::SystemSound::Name_) {
new flutter::platform::SystemSoundImpl(
mojo::InterfaceRequest<flutter::platform::SystemSound>(
client_handle.Pass()));
return;
}
if (service_name == flutter::platform::URLLauncher::Name_) {
new flutter::platform::URLLauncherImpl(
mojo::InterfaceRequest<flutter::platform::URLLauncher>(
client_handle.Pass()));
return;
}
if (service_name == ::vsync::VSyncProvider::Name_) {
new sky::services::vsync::VsyncProviderIOSImpl(
mojo::InterfaceRequest<::vsync::VSyncProvider>(client_handle.Pass()));

View File

@@ -52,7 +52,6 @@ shared_library("flutter_framework_dylib") {
"//flutter/services/activity",
"//flutter/services/editing",
"//flutter/services/engine:interfaces",
"//flutter/services/media",
"//flutter/services/platform",
"//flutter/services/vsync",
"//flutter/shell/common",

View File

@@ -2,8 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORM_PLUGIN_H_
#define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORM_PLUGIN_H_
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterJSONMessageListener.h"
@interface FlutterPlatformPlugin : FlutterJSONMessageListener
@end
namespace shell {
extern const char* const kOrientationUpdateNotificationName;
extern const char* const kOrientationUpdateNotificationKey;
extern const char* const kOverlayStyleUpdateNotificationName;
extern const char* const kOverlayStyleUpdateNotificationKey;
} // namespace shell
#endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_FLUTTERPLATFORM_PLUGIN_H_

View File

@@ -17,19 +17,21 @@ static NSDictionary* GetDirectoryOfType(NSSearchPathDirectory dir) {
return @{ @"path": paths.firstObject };
}
namespace flutter {
namespace platform {
namespace shell {
// TODO(abarth): Move these definitions from system_chrome_impl.cc to here.
extern const char* const kOrientationUpdateNotificationName;
extern const char* const kOrientationUpdateNotificationKey;
extern const char* const kOverlayStyleUpdateNotificationName;
extern const char* const kOverlayStyleUpdateNotificationKey;
const char* const kOrientationUpdateNotificationName =
"io.flutter.plugin.platform.SystemChromeOrientationNotificationName";
const char* const kOrientationUpdateNotificationKey =
"io.flutter.plugin.platform.SystemChromeOrientationNotificationKey";
const char* const kOverlayStyleUpdateNotificationName =
"io.flutter.plugin.platform.SystemChromeOverlayNotificationName";
const char* const kOverlayStyleUpdateNotificationKey =
"io.flutter.plugin.platform.SystemChromeOverlayNotificationKey";
} // namespace platform
} // namespace flutter
} // namespace shell
using namespace flutter::platform;
using namespace shell;
@implementation FlutterPlatformPlugin

View File

@@ -10,13 +10,12 @@
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "flutter/common/threads.h"
#include "flutter/services/platform/ios/system_chrome_impl.h"
#include "flutter/shell/gpu/gpu_rasterizer.h"
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h"
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
#include "lib/ftl/functional/make_copyable.h"
#include "lib/ftl/time/time_delta.h"
@@ -97,12 +96,12 @@ void FlutterInit(int argc, const char* argv[]) {
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(onOrientationPreferencesUpdated:)
name:@(flutter::platform::kOrientationUpdateNotificationName)
name:@(shell::kOrientationUpdateNotificationName)
object:nil];
[center addObserver:self
selector:@selector(onPreferredStatusBarStyleUpdated:)
name:@(flutter::platform::kOverlayStyleUpdateNotificationName)
name:@(shell::kOverlayStyleUpdateNotificationName)
object:nil];
[center addObserver:self
@@ -339,7 +338,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
NSDictionary* info = notification.userInfo;
NSNumber* update =
info[@(flutter::platform::kOrientationUpdateNotificationKey)];
info[@(shell::kOrientationUpdateNotificationKey)];
if (update == nil) {
return;
@@ -430,7 +429,7 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
NSDictionary* info = notification.userInfo;
NSNumber* update =
info[@(flutter::platform::kOverlayStyleUpdateNotificationKey)];
info[@(shell::kOverlayStyleUpdateNotificationKey)];
if (update == nil) {
return;

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:sky_services/media/media.mojom.dart';
export 'package:sky_services/media/media.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:mojo_services/mojo/geometry.mojom.dart';
export 'package:mojo_services/mojo/geometry.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:mojo_services/mojo/network_service.mojom.dart';
export 'package:mojo_services/mojo/network_service.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:mojo_services/mojo/url_loader.mojom.dart';
export 'package:mojo_services/mojo/url_loader.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:sky_services/flutter/platform/haptic_feedback.mojom.dart';
export 'package:sky_services/flutter/platform/haptic_feedback.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:sky_services/flutter/platform/path_provider.mojom.dart';
export 'package:sky_services/flutter/platform/path_provider.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:sky_services/flutter/platform/system_chrome.mojom.dart';
export 'package:sky_services/flutter/platform/system_chrome.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:sky_services/flutter/platform/system_sound.mojom.dart';
export 'package:sky_services/flutter/platform/system_sound.mojom.dart';

View File

@@ -1,6 +0,0 @@
/// Copyright 2016 The Chromium 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 'package:sky_services/flutter/platform/url_launcher.mojom.dart';
export 'package:sky_services/flutter/platform/url_launcher.mojom.dart';

View File

@@ -25,7 +25,6 @@ dart_pkg("sky_services") {
":copy_sky_services_license",
"//flutter/services/activity:interfaces",
"//flutter/services/editing:interfaces",
"//flutter/services/media:interfaces",
"//flutter/services/platform:interfaces",
"//flutter/services/raw_keyboard:interfaces",
]