浏览代码

refine fix

/zxw-fix_crash
xingweizhu 3 年前
当前提交
4fec7d10
共有 6 个文件被更改,包括 41 次插入57 次删除
  1. 16
      engine/src/shell/platform/unity/android/uiwidgets_panel.cc
  2. 2
      engine/src/shell/platform/unity/darwin/ios/uiwidgets_panel.h
  3. 22
      engine/src/shell/platform/unity/darwin/ios/uiwidgets_panel.mm
  4. 2
      engine/src/shell/platform/unity/darwin/macos/uiwidgets_panel.h
  5. 22
      engine/src/shell/platform/unity/darwin/macos/uiwidgets_panel.mm
  6. 34
      engine/src/shell/platform/unity/windows/uiwidgets_panel.cc

16
engine/src/shell/platform/unity/android/uiwidgets_panel.cc


const char *streaming_assets_path,
const char *settings)
{
surface_manager_ = std::make_unique<UnitySurfaceManager>(
UIWidgetsSystem::GetInstancePtr()->GetUnityInterfaces());
FML_DCHECK(fbo_ == 0);
surface_manager_->MakeCurrent(EGL_NO_DISPLAY);
fbo_ = surface_manager_->CreateRenderSurface(native_texture_ptr);
surface_manager_->ClearCurrent();
fml::AutoResetWaitableEvent latch;
std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(

});
latch.Wait();
surface_manager_ = std::make_unique<UnitySurfaceManager>(
UIWidgetsSystem::GetInstancePtr()->GetUnityInterfaces());
FML_DCHECK(fbo_ == 0);
surface_manager_->MakeCurrent(EGL_NO_DISPLAY);
fbo_ = surface_manager_->CreateRenderSurface(native_texture_ptr);
surface_manager_->ClearCurrent();
gfx_worker_task_runner_ = std::make_unique<GfxWorkerTaskRunner>(
gfx_worker_thread_id, [this](const auto *task) {

2
engine/src/shell/platform/unity/darwin/ios/uiwidgets_panel.h


private:
UIWidgetsPanel(Mono_Handle handle, UIWidgetsWindowType window_type, EntrypointCallback entrypoint_callback);
void CreateInternalUIWidgetsEngine(size_t width, size_t height, float device_pixel_ratio, const char* streaming_assets_path, const char* settings);
void CreateInternalUIWidgetsEngine(size_t width, size_t height, float device_pixel_ratio, const char* streaming_assets_path, const char* settings, std::thread::id gfx_worker_thread_id);
void dispatchTouches(float x, float y, int button, UIWidgetsTouchPhase evtType);

22
engine/src/shell/platform/unity/darwin/ios/uiwidgets_panel.mm


void* UIWidgetsPanel::OnEnable(size_t width, size_t height, float device_pixel_ratio,
const char* streaming_assets_path, const char* settings)
{
fml::AutoResetWaitableEvent latch;
std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(
[&latch, &gfx_worker_thread_id]() -> void {
gfx_worker_thread_id = std::this_thread::get_id();
latch.Signal();
});
latch.Wait();
CreateInternalUIWidgetsEngine(width, height, device_pixel_ratio, streaming_assets_path, settings);
CreateInternalUIWidgetsEngine(width, height, device_pixel_ratio, streaming_assets_path, settings, gfx_worker_thread_id);
const char* streaming_assets_path, const char* settings)
const char* streaming_assets_path, const char* settings, std::thread::id gfx_worker_thread_id)
fml::AutoResetWaitableEvent latch;
std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(
[&latch, &gfx_worker_thread_id]() -> void {
gfx_worker_thread_id = std::this_thread::get_id();
latch.Signal();
});
latch.Wait();
gfx_worker_task_runner_ = std::make_unique<GfxWorkerTaskRunner>(
gfx_worker_thread_id, [this](const auto* task) {
if (UIWidgetsEngineRunTask(engine_, task) != kSuccess) {

2
engine/src/shell/platform/unity/darwin/macos/uiwidgets_panel.h


private:
UIWidgetsPanel(Mono_Handle handle, UIWidgetsWindowType window_type, EntrypointCallback entrypoint_callback);
void CreateInternalUIWidgetsEngine(size_t width, size_t height, float device_pixel_ratio, const char* streaming_assets_path, const char* settings);
void CreateInternalUIWidgetsEngine(size_t width, size_t height, float device_pixel_ratio, const char* streaming_assets_path, const char* settings, std::thread::id gfx_worker_thread_id);
MouseState GetMouseState() { return mouse_state_; }

22
engine/src/shell/platform/unity/darwin/macos/uiwidgets_panel.mm


void* UIWidgetsPanel::OnEnable(size_t width, size_t height, float device_pixel_ratio,
const char* streaming_assets_path, const char* settings)
{
fml::AutoResetWaitableEvent latch;
std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(
[&latch, &gfx_worker_thread_id]() -> void {
gfx_worker_thread_id = std::this_thread::get_id();
latch.Signal();
});
latch.Wait();
CreateInternalUIWidgetsEngine(width, height, device_pixel_ratio, streaming_assets_path, settings);
CreateInternalUIWidgetsEngine(width, height, device_pixel_ratio, streaming_assets_path, settings, gfx_worker_thread_id);
const char* streaming_assets_path, const char* settings)
const char* streaming_assets_path, const char* settings, std::thread::id gfx_worker_thread_id)
fml::AutoResetWaitableEvent latch;
std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(
[&latch, &gfx_worker_thread_id]() -> void {
gfx_worker_thread_id = std::this_thread::get_id();
latch.Signal();
});
latch.Wait();
gfx_worker_task_runner_ = std::make_unique<GfxWorkerTaskRunner>(
gfx_worker_thread_id, [this](const auto* task) {
if (UIWidgetsEngineRunTask(engine_, task) != kSuccess) {

34
engine/src/shell/platform/unity/windows/uiwidgets_panel.cc


namespace uiwidgets {
std::thread::id gfx_worker_thread_id;
int worker_set = 0;
fml::RefPtr<UIWidgetsPanel> UIWidgetsPanel::Create(
Mono_Handle handle, UIWidgetsWindowType window_type, EntrypointCallback entrypoint_callback) {
return fml::MakeRefCounted<UIWidgetsPanel>(handle, window_type, entrypoint_callback);

const char* streaming_assets_path,
const char* settings) {
fml::AutoResetWaitableEvent latch2;
// std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker([&latch2]() -> void {
latch2.Signal();
});
latch2.Wait();
fml::AutoResetWaitableEvent latch;
std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(
[&latch, &gfx_worker_thread_id]() -> void {
gfx_worker_thread_id = std::this_thread::get_id();
latch.Signal();
});
latch.Wait();
surface_manager_ = std::make_unique<UnitySurfaceManager>(
UIWidgetsSystem::GetInstancePtr()->GetUnityInterfaces());

void* d3dtexture = surface_manager_->GetD3DInnerTexture();
surface_manager_->ClearCurrent();
if (worker_set == 0)
{
fml::AutoResetWaitableEvent latch;
//std::thread::id gfx_worker_thread_id;
UIWidgetsSystem::GetInstancePtr()->PostTaskToGfxWorker(
[&latch]() -> void {
gfx_worker_thread_id = std::this_thread::get_id();
latch.Signal();
});
latch.Wait();
worker_set = 1;
}
gfx_worker_task_runner_ = std::make_unique<GfxWorkerTaskRunner>(
gfx_worker_thread_id, [this](const auto* task) {
if (UIWidgetsEngineRunTask(engine_, task) != kSuccess) {

正在加载...
取消
保存