mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
ui.Canvas and ui.SceneBuilder now use the DlPath object directly from the ui.Path object. This results in increased sharing of the wrapper objects which then increases the sharing of both the converted Impeller paths and Skia's volatile flag. The VolatilePathTracker mechanism is deleted and rather than count the number of frames that a path is stable for, instead we count the number of times it is used for rendering. If a path is used 100 times in a single frame, it will become non-volatile and start being cached almost immediately. The cached Impeller paths are now also tracked for all instances of the same path, rather than for each call site that originated from a DisplayList dispatch.
73 lines
2.1 KiB
C++
73 lines
2.1 KiB
C++
// Copyright 2013 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.
|
|
|
|
#ifndef FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
|
|
#define FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
|
|
|
|
#include "flutter/common/task_runners.h"
|
|
#include "flutter/fml/make_copyable.h"
|
|
#include "flutter/fml/paths.h"
|
|
#include "flutter/fml/synchronization/waitable_event.h"
|
|
#include "flutter/fml/thread.h"
|
|
#include "flutter/runtime/dart_isolate.h"
|
|
#include "flutter/runtime/dart_vm.h"
|
|
#include "flutter/runtime/dart_vm_lifecycle.h"
|
|
|
|
namespace flutter {
|
|
namespace testing {
|
|
|
|
class AutoIsolateShutdown {
|
|
public:
|
|
AutoIsolateShutdown() = default;
|
|
|
|
AutoIsolateShutdown(std::shared_ptr<DartIsolate> isolate,
|
|
fml::RefPtr<fml::TaskRunner> runner);
|
|
|
|
~AutoIsolateShutdown();
|
|
|
|
bool IsValid() const { return isolate_ != nullptr && runner_; }
|
|
|
|
[[nodiscard]] bool RunInIsolateScope(
|
|
const std::function<bool(void)>& closure);
|
|
|
|
void Shutdown();
|
|
|
|
DartIsolate* get() {
|
|
FML_CHECK(isolate_);
|
|
return isolate_.get();
|
|
}
|
|
|
|
private:
|
|
std::shared_ptr<DartIsolate> isolate_;
|
|
fml::RefPtr<fml::TaskRunner> runner_;
|
|
|
|
FML_DISALLOW_COPY_AND_ASSIGN(AutoIsolateShutdown);
|
|
};
|
|
|
|
void RunDartCodeInIsolate(
|
|
DartVMRef& vm_ref,
|
|
std::unique_ptr<AutoIsolateShutdown>& result,
|
|
const Settings& settings,
|
|
const TaskRunners& task_runners,
|
|
std::string entrypoint,
|
|
const std::vector<std::string>& args,
|
|
const std::string& fixtures_path,
|
|
fml::WeakPtr<IOManager> io_manager = {},
|
|
std::unique_ptr<PlatformConfiguration> platform_configuration = nullptr);
|
|
|
|
std::unique_ptr<AutoIsolateShutdown> RunDartCodeInIsolate(
|
|
DartVMRef& vm_ref,
|
|
const Settings& settings,
|
|
const TaskRunners& task_runners,
|
|
std::string entrypoint,
|
|
const std::vector<std::string>& args,
|
|
const std::string& fixtures_path,
|
|
fml::WeakPtr<IOManager> io_manager = {},
|
|
std::unique_ptr<PlatformConfiguration> platform_configuration = nullptr);
|
|
|
|
} // namespace testing
|
|
} // namespace flutter
|
|
|
|
#endif // FLUTTER_TESTING_DART_ISOLATE_RUNNER_H_
|