Skip to content

Commit

Permalink
Make public members of FlutterTizenEngine class private (#161)
Browse files Browse the repository at this point in the history
* Make public members of FlutterTizenEngine class private

* Organize includes and clean up
  • Loading branch information
swift-kim committed Feb 11, 2022
1 parent 322d245 commit f905990
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 123 deletions.
6 changes: 3 additions & 3 deletions shell/platform/tizen/channels/app_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// found in the LICENSE file.

#include "app_control.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h"

#include "flutter/shell/platform/tizen/channels/app_control_channel.h"

namespace flutter {
Expand Down Expand Up @@ -109,8 +109,8 @@ AppControlResult AppControl::SetExtraData(const EncodableMap& map) {
return AppControlResult();
}

void AppControl::SetManager(AppControlChannel* m) {
manager_ = m;
void AppControl::SetManager(AppControlChannel* manager) {
manager_ = manager;
}

AppControlChannel* AppControl::GetManager() {
Expand Down
5 changes: 0 additions & 5 deletions shell/platform/tizen/channels/app_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@
#define EMBEDDER_APP_CONTROL_H_

#include <app.h>
#include <queue>
#include <unordered_map>

#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/event_channel.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_method_codec.h"
#include "flutter/shell/platform/tizen/logger.h"

namespace flutter {
Expand Down
14 changes: 8 additions & 6 deletions shell/platform/tizen/channels/app_control_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <app.h>

#include "app_control.h"
#include "app_control_channel.h"

#include "flutter/shell/platform/common/client_wrapper/include/flutter/event_stream_handler_functions.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_method_codec.h"

namespace flutter {

static constexpr char kChannelName[] = "tizen/internal/app_control_method";
static constexpr char kEventChannelName[] = "tizen/internal/app_control_event";
static constexpr char kReplyChannelName[] = "tizen/internal/app_control_reply";
namespace {

constexpr char kChannelName[] = "tizen/internal/app_control_method";
constexpr char kEventChannelName[] = "tizen/internal/app_control_event";
constexpr char kReplyChannelName[] = "tizen/internal/app_control_reply";

} // namespace

AppControlChannel::AppControlChannel(BinaryMessenger* messenger) {
method_channel_ = std::make_unique<MethodChannel<EncodableValue>>(
Expand Down
11 changes: 4 additions & 7 deletions shell/platform/tizen/channels/app_control_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
#ifndef EMBEDDER_APP_CONTROL_CHANNEL_H_
#define EMBEDDER_APP_CONTROL_CHANNEL_H_

#include <memory>
#include <queue>
#include <unordered_map>

#include "flutter/shell/platform/common/client_wrapper/include/flutter/binary_messenger.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/encodable_value.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/event_channel.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/method_channel.h"
#include "flutter/shell/platform/common/client_wrapper/include/flutter/standard_method_codec.h"
#include "flutter/shell/platform/tizen/channels/app_control.h"
#include "flutter/shell/platform/tizen/logger.h"

#include "app_control.h"

namespace flutter {

class AppControlChannel {
Expand All @@ -33,13 +32,11 @@ class AppControlChannel {
private:
void HandleMethodCall(const MethodCall<EncodableValue>& method_call,
std::unique_ptr<MethodResult<EncodableValue>> result);
void RegisterEventHandler(
std::unique_ptr<flutter::EventSink<EncodableValue>> events);
void RegisterEventHandler(std::unique_ptr<EventSink<EncodableValue>> events);
void UnregisterEventHandler();
void SendAlreadyQueuedEvents();

void RegisterReplyHandler(
std::unique_ptr<flutter::EventSink<EncodableValue>> events);
void RegisterReplyHandler(std::unique_ptr<EventSink<EncodableValue>> events);
void UnregisterReplyHandler();

template <typename T>
Expand Down
30 changes: 16 additions & 14 deletions shell/platform/tizen/flutter_tizen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ void FlutterDesktopShutdownEngine(FlutterDesktopEngineRef engine_ref) {
void FlutterDesktopPluginRegistrarEnableInputBlocking(
FlutterDesktopPluginRegistrarRef registrar,
const char* channel) {
registrar->engine->message_dispatcher->EnableInputBlockingForChannel(channel);
registrar->engine->message_dispatcher()->EnableInputBlockingForChannel(
channel);
}

FlutterDesktopPluginRegistrarRef FlutterDesktopGetPluginRegistrar(
Expand All @@ -65,17 +66,17 @@ FlutterDesktopPluginRegistrarRef FlutterDesktopGetPluginRegistrar(
// Currently, one registrar acts as the registrar for all plugins, so the
// name is ignored. It is part of the API to reduce churn in the future when
// aligning more closely with the Flutter registrar system.
return EngineFromHandle(engine)->GetPluginRegistrar();
return EngineFromHandle(engine)->plugin_registrar();
}

FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger(
FlutterDesktopEngineRef engine) {
return EngineFromHandle(engine)->messenger.get();
return EngineFromHandle(engine)->messenger();
}

FlutterDesktopMessengerRef FlutterDesktopPluginRegistrarGetMessenger(
FlutterDesktopPluginRegistrarRef registrar) {
return registrar->engine->messenger.get();
return registrar->engine->messenger();
}

void FlutterDesktopPluginRegistrarSetDestructionHandler(
Expand Down Expand Up @@ -114,14 +115,15 @@ void FlutterDesktopMessengerSetCallback(FlutterDesktopMessengerRef messenger,
const char* channel,
FlutterDesktopMessageCallback callback,
void* user_data) {
messenger->engine->message_dispatcher->SetMessageCallback(channel, callback,
user_data);
messenger->engine->message_dispatcher()->SetMessageCallback(channel, callback,
user_data);
}

void FlutterDesktopNotifyAppControl(FlutterDesktopEngineRef engine,
void* app_control) {
#ifndef __X64_SHELL__
EngineFromHandle(engine)->app_control_channel->NotifyAppControl(app_control);
EngineFromHandle(engine)->app_control_channel()->NotifyAppControl(
app_control);
#endif
}

Expand All @@ -134,27 +136,27 @@ void FlutterDesktopNotifyLowMemoryWarning(FlutterDesktopEngineRef engine) {
}

void FlutterDesktopNotifyAppIsInactive(FlutterDesktopEngineRef engine) {
EngineFromHandle(engine)->lifecycle_channel->AppIsInactive();
EngineFromHandle(engine)->lifecycle_channel()->AppIsInactive();
}

void FlutterDesktopNotifyAppIsResumed(FlutterDesktopEngineRef engine) {
EngineFromHandle(engine)->lifecycle_channel->AppIsResumed();
EngineFromHandle(engine)->lifecycle_channel()->AppIsResumed();
}

void FlutterDesktopNotifyAppIsPaused(FlutterDesktopEngineRef engine) {
EngineFromHandle(engine)->lifecycle_channel->AppIsPaused();
EngineFromHandle(engine)->lifecycle_channel()->AppIsPaused();
}

void FlutterDesktopNotifyAppIsDetached(FlutterDesktopEngineRef engine) {
EngineFromHandle(engine)->lifecycle_channel->AppIsDetached();
EngineFromHandle(engine)->lifecycle_channel()->AppIsDetached();
}

void FlutterRegisterViewFactory(
FlutterDesktopPluginRegistrarRef registrar,
const char* view_type,
std::unique_ptr<PlatformViewFactory> view_factory) {
view_factory->SetWindow(registrar->engine->renderer->GetWindowHandle());
registrar->engine->platform_view_channel->ViewFactories().insert(
view_factory->SetWindow(registrar->engine->renderer()->GetWindowHandle());
registrar->engine->platform_view_channel()->ViewFactories().insert(
std::pair<std::string, std::unique_ptr<PlatformViewFactory>>(
view_type, std::move(view_factory)));
}
Expand All @@ -173,7 +175,7 @@ static FlutterDesktopTextureRegistrarRef HandleForTextureRegistrar(

FlutterDesktopTextureRegistrarRef FlutterDesktopRegistrarGetTextureRegistrar(
FlutterDesktopPluginRegistrarRef registrar) {
return HandleForTextureRegistrar(registrar->engine->GetTextureRegistrar());
return HandleForTextureRegistrar(registrar->engine->texture_registrar());
}

int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(
Expand Down
Loading

0 comments on commit f905990

Please sign in to comment.