Files
engine/runtime/runtime_controller.h
T

79 lines
2.5 KiB
C++
Raw Normal View History

2015-05-18 14:48:27 -07:00
// Copyright 2015 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.
2016-08-13 00:18:58 -07:00
#ifndef FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
#define FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_
2015-05-18 14:48:27 -07:00
#include <memory>
2016-08-09 12:48:29 -07:00
#include "flutter/flow/layers/layer_tree.h"
#include "flutter/lib/ui/ui_dart_state.h"
#include "flutter/lib/ui/window/pointer_data_packet.h"
#include "flutter/lib/ui/window/window.h"
#include "lib/fxl/macros.h"
2015-05-18 14:48:27 -07:00
namespace blink {
2015-05-19 10:55:07 -07:00
class DartController;
2015-06-25 13:59:22 -07:00
class DartLibraryProvider;
class Scene;
2016-08-13 00:18:58 -07:00
class RuntimeDelegate;
2015-06-25 13:59:22 -07:00
class View;
class Window;
2015-05-18 14:48:27 -07:00
2016-08-13 00:18:58 -07:00
class RuntimeController : public WindowClient, public IsolateClient {
2015-05-18 14:48:27 -07:00
public:
2016-08-13 00:18:58 -07:00
static std::unique_ptr<RuntimeController> Create(RuntimeDelegate* client);
~RuntimeController();
2017-04-11 14:53:14 -07:00
void CreateDartController(const std::string& script_uri,
const uint8_t* isolate_snapshot_data,
const uint8_t* isolate_snapshot_instr);
2016-08-13 00:18:58 -07:00
DartController* dart_controller() const { return dart_controller_.get(); }
2015-05-18 14:48:27 -07:00
void SetViewportMetrics(const ViewportMetrics& metrics);
void SetLocale(const std::string& language_code,
2016-08-01 15:11:56 -07:00
const std::string& country_code);
void SetUserSettingsData(const std::string& data);
void SetSemanticsEnabled(bool enabled);
void BeginFrame(fxl::TimePoint frame_time);
void NotifyIdle(int64_t deadline);
void DispatchPlatformMessage(fxl::RefPtr<PlatformMessage> message);
void DispatchPointerDataPacket(const PointerDataPacket& packet);
void DispatchSemanticsAction(int32_t id, SemanticsAction action);
2015-05-18 14:48:27 -07:00
Dart_Port GetMainPort();
std::string GetIsolateName();
bool HasLivePorts();
tonic::DartErrorHandleType GetLastError();
2015-05-18 14:48:27 -07:00
private:
2016-08-13 00:18:58 -07:00
explicit RuntimeController(RuntimeDelegate* client);
2015-05-19 10:55:07 -07:00
Window* GetWindow();
2017-06-06 10:59:41 +02:00
std::string DefaultRouteName() override;
void ScheduleFrame() override;
void Render(Scene* scene) override;
void UpdateSemantics(SemanticsUpdate* update) override;
void HandlePlatformMessage(fxl::RefPtr<PlatformMessage> message) override;
2015-05-19 14:20:04 -07:00
void DidCreateSecondaryIsolate(Dart_Isolate isolate) override;
void DidShutdownMainIsolate() override;
2016-08-13 00:18:58 -07:00
RuntimeDelegate* client_;
std::string language_code_;
std::string country_code_;
std::string user_settings_data_ = "{}";
bool semantics_enabled_ = false;
std::unique_ptr<DartController> dart_controller_;
2015-05-19 14:20:04 -07:00
FXL_DISALLOW_COPY_AND_ASSIGN(RuntimeController);
2015-05-18 14:48:27 -07:00
};
2016-08-01 15:11:56 -07:00
} // namespace blink
2015-05-18 14:48:27 -07:00
2016-08-13 00:18:58 -07:00
#endif // FLUTTER_RUNTIME_RUNTIME_CONTROLLER_H_