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>
|
2015-05-21 12:46:36 -07:00
|
|
|
|
2016-08-09 12:48:29 -07:00
|
|
|
#include "flutter/flow/layers/layer_tree.h"
|
2016-08-12 16:12:07 -07:00
|
|
|
#include "flutter/lib/ui/ui_dart_state.h"
|
2016-09-28 15:50:09 -07:00
|
|
|
#include "flutter/lib/ui/window/pointer_data_packet.h"
|
2016-08-12 16:12:07 -07:00
|
|
|
#include "flutter/lib/ui/window/window.h"
|
2017-09-11 15:58:48 -07:00
|
|
|
#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;
|
2015-10-25 00:33:41 -07:00
|
|
|
class Scene;
|
2016-08-13 00:18:58 -07:00
|
|
|
class RuntimeDelegate;
|
2015-06-25 13:59:22 -07:00
|
|
|
class View;
|
2015-10-25 00:33:41 -07:00
|
|
|
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,
|
2017-10-24 19:37:24 -07:00
|
|
|
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
|
|
|
|
2016-10-27 13:12:55 -07:00
|
|
|
void SetViewportMetrics(const ViewportMetrics& metrics);
|
2015-12-07 10:51:47 -08:00
|
|
|
void SetLocale(const std::string& language_code,
|
2016-08-01 15:11:56 -07:00
|
|
|
const std::string& country_code);
|
2017-10-18 16:13:43 -07:00
|
|
|
void SetUserSettingsData(const std::string& data);
|
2016-10-05 12:22:03 -07:00
|
|
|
void SetSemanticsEnabled(bool enabled);
|
2015-09-03 13:32:44 -07:00
|
|
|
|
2017-09-11 15:58:48 -07:00
|
|
|
void BeginFrame(fxl::TimePoint frame_time);
|
2017-09-01 11:11:25 -07:00
|
|
|
void NotifyIdle(int64_t deadline);
|
2015-05-21 12:46:36 -07:00
|
|
|
|
2017-09-11 15:58:48 -07:00
|
|
|
void DispatchPlatformMessage(fxl::RefPtr<PlatformMessage> message);
|
2016-10-05 12:22:03 -07:00
|
|
|
void DispatchPointerDataPacket(const PointerDataPacket& packet);
|
|
|
|
|
void DispatchSemanticsAction(int32_t id, SemanticsAction action);
|
2015-05-18 14:48:27 -07:00
|
|
|
|
2016-08-08 13:04:15 -07:00
|
|
|
Dart_Port GetMainPort();
|
2016-08-16 12:16:41 -07:00
|
|
|
std::string GetIsolateName();
|
2017-01-24 15:39:30 -08:00
|
|
|
bool HasLivePorts();
|
2017-01-27 09:59:08 -08:00
|
|
|
tonic::DartErrorHandleType GetLastError();
|
2017-01-24 15:39:30 -08:00
|
|
|
|
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
|
|
|
|
2015-10-25 00:33:41 -07:00
|
|
|
Window* GetWindow();
|
|
|
|
|
|
2017-06-06 10:59:41 +02:00
|
|
|
std::string DefaultRouteName() override;
|
2015-10-25 00:33:41 -07:00
|
|
|
void ScheduleFrame() override;
|
|
|
|
|
void Render(Scene* scene) override;
|
2016-10-05 12:22:03 -07:00
|
|
|
void UpdateSemantics(SemanticsUpdate* update) override;
|
2017-09-11 15:58:48 -07:00
|
|
|
void HandlePlatformMessage(fxl::RefPtr<PlatformMessage> message) override;
|
2015-05-19 14:20:04 -07:00
|
|
|
|
2016-02-25 13:41:49 -08:00
|
|
|
void DidCreateSecondaryIsolate(Dart_Isolate isolate) override;
|
2017-11-15 13:28:21 -08:00
|
|
|
void DidShutdownMainIsolate() override;
|
2016-02-25 13:41:49 -08:00
|
|
|
|
2016-08-13 00:18:58 -07:00
|
|
|
RuntimeDelegate* client_;
|
2015-12-07 10:51:47 -08:00
|
|
|
std::string language_code_;
|
|
|
|
|
std::string country_code_;
|
2017-10-18 16:13:43 -07:00
|
|
|
std::string user_settings_data_ = "{}";
|
2016-10-05 12:22:03 -07:00
|
|
|
bool semantics_enabled_ = false;
|
2015-10-25 00:33:41 -07:00
|
|
|
std::unique_ptr<DartController> dart_controller_;
|
2015-05-19 14:20:04 -07:00
|
|
|
|
2017-09-11 15:58:48 -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_
|