Skip to content

Commit

Permalink
Revert "Roll Fuchsia buildtools to 85907c59e97527d79bbfdfd849d8e85c24…
Browse files Browse the repository at this point in the history
…959cc5 (flutter#4331)" (flutter#4340)

With the update to HEAD of the Fuchsia buildtools repo, the new clang
toolchain picked up caused link-time breakage in android x86_64
libFlutter.so builds.

Sample log:
https://build.chromium.org/p/client.flutter/builders/Linux%20Engine/builds/1974/steps/build%20android_debug_x64/logs/stdio

Sample failure:
FAILED: libflutter.so libflutter.so.TOC lib.stripped/libflutter.so
../../third_party/android_tools/ndk/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: obj/flutter/shell/platform/android/libflutter/android_context_gl.o: unsupported reloc 42 against global symbol std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id

This reverts commit 8ad42f0.
  • Loading branch information
cbracken authored Nov 9, 2017
1 parent a8237ec commit bc2acf7
Show file tree
Hide file tree
Showing 32 changed files with 290 additions and 263 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ vars = {
# Build bot tooling for iOS
'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f',

'buildtools_revision': '85907c59e97527d79bbfdfd849d8e85c24959cc5',
'buildtools_revision': '5b8eb38aaf523f0124756454276cd0a5b720c17e',
}

# Only these hosts are allowed for dependencies in this DEPS file.
Expand All @@ -114,7 +114,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a457e1429ed9e4a1869c8192b846bebb481f333a',
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'd65893e469b3cdff75e0a157a5a219096ca6193a',

# Fuchsia compatibility
#
Expand Down
97 changes: 49 additions & 48 deletions content_handler/runtime_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ RuntimeHolder::RuntimeHolder()

RuntimeHolder::~RuntimeHolder() {
blink::Threads::Gpu()->PostTask(
fxl::MakeCopyable([rasterizer = std::move(rasterizer_)]() {
// Deletes rasterizer.
fxl::MakeCopyable([rasterizer = std::move(rasterizer_)](){
// Deletes rasterizer.
}));
}

Expand Down Expand Up @@ -227,32 +227,33 @@ void RuntimeHolder::CreateView(
fidl::InterfaceHandle<scenic::SceneManager> scene_manager;
view_manager_->GetSceneManager(scene_manager.NewRequest());

blink::Threads::Gpu()->PostTask(
fxl::MakeCopyable([rasterizer = rasterizer_.get(), //
scene_manager = std::move(scene_manager), //
import_token = std::move(import_token), //
weak_runtime_holder = GetWeakPtr()]() mutable {
ASSERT_IS_GPU_THREAD;
rasterizer->SetScene(
std::move(scene_manager), std::move(import_token),
// TODO(MZ-222): Ideally we would immediately redraw the previous
// layer tree when the metrics change since there's no need to
// rerecord it. However, we want to make sure there's only one
// outstanding frame. We should improve the frame scheduling so that
// the rasterizer thread can self-schedule re-rasterization.
[weak_runtime_holder] {
// This is on the GPU thread thread. Post to the Platform/UI
// thread for the completion callback.
ASSERT_IS_GPU_THREAD;
blink::Threads::Platform()->PostTask([weak_runtime_holder]() {
// On the Platform/UI thread.
ASSERT_IS_UI_THREAD;
if (weak_runtime_holder) {
weak_runtime_holder->OnRedrawFrame();
}
});
});
}));
blink::Threads::Gpu()->PostTask(fxl::MakeCopyable([
rasterizer = rasterizer_.get(), //
scene_manager = std::move(scene_manager), //
import_token = std::move(import_token), //
weak_runtime_holder = GetWeakPtr()
]() mutable {
ASSERT_IS_GPU_THREAD;
rasterizer->SetScene(
std::move(scene_manager), std::move(import_token),
// TODO(MZ-222): Ideally we would immediately redraw the previous layer
// tree when the metrics change since there's no need to rerecord it.
// However, we want to make sure there's only one outstanding frame.
// We should improve the frame scheduling so that the rasterizer thread
// can self-schedule re-rasterization.
[weak_runtime_holder] {
// This is on the GPU thread thread. Post to the Platform/UI
// thread for the completion callback.
ASSERT_IS_GPU_THREAD;
blink::Threads::Platform()->PostTask([weak_runtime_holder]() {
// On the Platform/UI thread.
ASSERT_IS_UI_THREAD;
if (weak_runtime_holder) {
weak_runtime_holder->OnRedrawFrame();
}
});
});
}));
runtime_ = blink::RuntimeController::Create(this);

const uint8_t* isolate_snapshot_data;
Expand Down Expand Up @@ -330,27 +331,27 @@ void RuntimeHolder::Render(std::unique_ptr<flow::LayerTree> layer_tree) {

// We are on the Platform/UI thread. Post to the GPU thread to render.
ASSERT_IS_PLATFORM_THREAD;
blink::Threads::Gpu()->PostTask(
fxl::MakeCopyable([rasterizer = rasterizer_.get(), //
layer_tree = std::move(layer_tree), //
weak_runtime_holder = GetWeakPtr() //
blink::Threads::Gpu()->PostTask(fxl::MakeCopyable([
rasterizer = rasterizer_.get(), //
layer_tree = std::move(layer_tree), //
weak_runtime_holder = GetWeakPtr() //
]() mutable {
// On the GPU Thread.
ASSERT_IS_GPU_THREAD;
rasterizer->Draw(std::move(layer_tree), [weak_runtime_holder]() {
// This is on the GPU thread thread. Post to the Platform/UI thread
// for the completion callback.
ASSERT_IS_GPU_THREAD;
blink::Threads::Platform()->PostTask([weak_runtime_holder]() {
// On the Platform/UI thread.
ASSERT_IS_UI_THREAD;
if (weak_runtime_holder) {
weak_runtime_holder->frame_rendering_ = false;
weak_runtime_holder->OnFrameComplete();
}
});
});
}));
// On the GPU Thread.
ASSERT_IS_GPU_THREAD;
rasterizer->Draw(std::move(layer_tree), [weak_runtime_holder]() {
// This is on the GPU thread thread. Post to the Platform/UI thread
// for the completion callback.
ASSERT_IS_GPU_THREAD;
blink::Threads::Platform()->PostTask([weak_runtime_holder]() {
// On the Platform/UI thread.
ASSERT_IS_UI_THREAD;
if (weak_runtime_holder) {
weak_runtime_holder->frame_rendering_ = false;
weak_runtime_holder->OnFrameComplete();
}
});
});
}));
}

void RuntimeHolder::UpdateSemantics(std::vector<blink::SemanticsNode> update) {
Expand Down
40 changes: 21 additions & 19 deletions lib/ui/painting/codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ void InitCodecAndInvokeCodecCallback(
sk_sp<SkData> buffer,
size_t trace_id) {
auto codec = InitCodec(std::move(buffer), trace_id);
Threads::UI()->PostTask(
fxl::MakeCopyable([callback = std::move(callback),
codec = std::move(codec), trace_id]() mutable {
InvokeCodecCallback(std::move(codec), std::move(callback), trace_id);
}));
Threads::UI()->PostTask(fxl::MakeCopyable([
callback = std::move(callback), codec = std::move(codec), trace_id
]() mutable {
InvokeCodecCallback(std::move(codec), std::move(callback), trace_id);
}));
}

void InstantiateImageCodec(Dart_NativeArguments args) {
Expand All @@ -124,13 +124,14 @@ void InstantiateImageCodec(Dart_NativeArguments args) {

auto buffer = SkData::MakeWithCopy(list.data(), list.num_elements());

Threads::IO()->PostTask(
fxl::MakeCopyable([callback = std::make_unique<DartPersistentValue>(
tonic::DartState::Current(), callback_handle),
buffer = std::move(buffer), trace_id]() mutable {
InitCodecAndInvokeCodecCallback(std::move(callback), std::move(buffer),
trace_id);
}));
Threads::IO()->PostTask(fxl::MakeCopyable([
callback = std::make_unique<DartPersistentValue>(
tonic::DartState::Current(), callback_handle),
buffer = std::move(buffer), trace_id
]() mutable {
InitCodecAndInvokeCodecCallback(std::move(callback), std::move(buffer),
trace_id);
}));
}

bool copy_to(SkBitmap* dst, SkColorType dstColorType, const SkBitmap& src) {
Expand Down Expand Up @@ -252,7 +253,7 @@ void MultiFrameCodec::GetNextFrameAndInvokeCallback(
nextFrameIndex_ = (nextFrameIndex_ + 1) % frameInfos_.size();

Threads::UI()->PostTask(fxl::MakeCopyable(
[callback = std::move(callback), frameInfo, trace_id]() mutable {
[ callback = std::move(callback), frameInfo, trace_id ]() mutable {
InvokeNextFrameCallback(frameInfo, std::move(callback), trace_id);
}));

Expand All @@ -269,12 +270,13 @@ Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) {
return ToDart("Callback must be a function");
}

Threads::IO()->PostTask(
fxl::MakeCopyable([callback = std::make_unique<DartPersistentValue>(
tonic::DartState::Current(), callback_handle),
this, trace_id]() mutable {
GetNextFrameAndInvokeCallback(std::move(callback), trace_id);
}));
Threads::IO()->PostTask(fxl::MakeCopyable([
callback = std::make_unique<DartPersistentValue>(
tonic::DartState::Current(), callback_handle),
this, trace_id
]() mutable {
GetNextFrameAndInvokeCallback(std::move(callback), trace_id);
}));

return Dart_Null();
}
Expand Down
22 changes: 11 additions & 11 deletions lib/ui/painting/image_decoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ void DecodeImageAndInvokeImageCallback(
sk_sp<SkData> buffer,
size_t trace_id) {
sk_sp<SkImage> image = DecodeImage(std::move(buffer), trace_id);
Threads::UI()->PostTask(fxl::MakeCopyable(
[callback = std::move(callback), image, trace_id]() mutable {
InvokeImageCallback(image, std::move(callback), trace_id);
}));
Threads::UI()->PostTask(fxl::MakeCopyable([
callback = std::move(callback), image, trace_id
]() mutable { InvokeImageCallback(image, std::move(callback), trace_id); }));
}

void DecodeImageFromList(Dart_NativeArguments args) {
Expand All @@ -98,13 +97,14 @@ void DecodeImageFromList(Dart_NativeArguments args) {

auto buffer = SkData::MakeWithCopy(list.data(), list.num_elements());

Threads::IO()->PostTask(
fxl::MakeCopyable([callback = std::make_unique<DartPersistentValue>(
tonic::DartState::Current(), callback_handle),
buffer = std::move(buffer), trace_id]() mutable {
DecodeImageAndInvokeImageCallback(std::move(callback),
std::move(buffer), trace_id);
}));
Threads::IO()->PostTask(fxl::MakeCopyable([
callback = std::make_unique<DartPersistentValue>(
tonic::DartState::Current(), callback_handle),
buffer = std::move(buffer), trace_id
]() mutable {
DecodeImageAndInvokeImageCallback(std::move(callback), std::move(buffer),
trace_id);
}));
}

} // namespace
Expand Down
8 changes: 5 additions & 3 deletions lib/ui/window/platform_message_response_dart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ PlatformMessageResponseDart::PlatformMessageResponseDart(

PlatformMessageResponseDart::~PlatformMessageResponseDart() {
if (!callback_.is_empty()) {
Threads::UI()->PostTask(fxl::MakeCopyable(
[callback = std::move(callback_)]() mutable { callback.Clear(); }));
Threads::UI()->PostTask(
fxl::MakeCopyable([callback = std::move(callback_)]() mutable {
callback.Clear();
}));
}
}

Expand All @@ -30,7 +32,7 @@ void PlatformMessageResponseDart::Complete(std::vector<uint8_t> data) {
FXL_DCHECK(!is_complete_);
is_complete_ = true;
Threads::UI()->PostTask(fxl::MakeCopyable(
[callback = std::move(callback_), data = std::move(data)]() mutable {
[ callback = std::move(callback_), data = std::move(data) ]() mutable {
tonic::DartState* dart_state = callback.dart_state().get();
if (!dart_state)
return;
Expand Down
45 changes: 23 additions & 22 deletions shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ void Animator::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
// Commit the pending continuation.
producer_continuation_.Complete(std::move(layer_tree));

blink::Threads::Gpu()->PostTask([rasterizer = rasterizer_,
pipeline = layer_tree_pipeline_,
frame_id = FrameParity()]() {
blink::Threads::Gpu()->PostTask([
rasterizer = rasterizer_, pipeline = layer_tree_pipeline_,
frame_id = FrameParity()
]() {
if (!rasterizer.get())
return;
TRACE_EVENT2("flutter", "GPU Workload", "mode", "basic", "frame", frame_id);
Expand Down Expand Up @@ -150,29 +151,29 @@ void Animator::RequestFrame(bool regenerate_layer_tree) {
// started an expensive operation right after posting this message however.
// To support that, we need edge triggered wakes on VSync.

blink::Threads::UI()->PostTask([self = weak_factory_.GetWeakPtr(),
frame_number = frame_number_]() {
if (!self.get()) {
return;
}
TRACE_EVENT_ASYNC_BEGIN0("flutter", "Frame Request Pending", frame_number);
self->AwaitVSync();
});
blink::Threads::UI()->PostTask(
[ self = weak_factory_.GetWeakPtr(), frame_number = frame_number_ ]() {
if (!self.get()) {
return;
}
TRACE_EVENT_ASYNC_BEGIN0("flutter", "Frame Request Pending",
frame_number);
self->AwaitVSync();
});
frame_scheduled_ = true;
}

void Animator::AwaitVSync() {
waiter_->AsyncWaitForVsync(
[self = weak_factory_.GetWeakPtr()](fxl::TimePoint frame_start_time,
fxl::TimePoint frame_target_time) {
if (self) {
if (self->CanReuseLastLayerTree()) {
self->DrawLastLayerTree();
} else {
self->BeginFrame(frame_start_time, frame_target_time);
}
}
});
waiter_->AsyncWaitForVsync([self = weak_factory_.GetWeakPtr()](
fxl::TimePoint frame_start_time, fxl::TimePoint frame_target_time) {
if (self) {
if (self->CanReuseLastLayerTree()) {
self->DrawLastLayerTree();
} else {
self->BeginFrame(frame_start_time, frame_target_time);
}
}
});

engine_->NotifyIdle(dart_frame_deadline_);
}
Expand Down
24 changes: 12 additions & 12 deletions shell/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,12 @@ void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
}

void Engine::UpdateSemantics(std::vector<blink::SemanticsNode> update) {
blink::Threads::Platform()->PostTask(
fxl::MakeCopyable([platform_view = platform_view_.lock(),
update = std::move(update)]() mutable {
if (platform_view)
platform_view->UpdateSemantics(std::move(update));
}));
blink::Threads::Platform()->PostTask(fxl::MakeCopyable([
platform_view = platform_view_.lock(), update = std::move(update)
]() mutable {
if (platform_view)
platform_view->UpdateSemantics(std::move(update));
}));
}

void Engine::HandlePlatformMessage(
Expand All @@ -554,12 +554,12 @@ void Engine::HandlePlatformMessage(
HandleAssetPlatformMessage(std::move(message));
return;
}
blink::Threads::Platform()->PostTask(
[platform_view = platform_view_.lock(),
message = std::move(message)]() mutable {
if (platform_view)
platform_view->HandlePlatformMessage(std::move(message));
});
blink::Threads::Platform()->PostTask([
platform_view = platform_view_.lock(), message = std::move(message)
]() mutable {
if (platform_view)
platform_view->HandlePlatformMessage(std::move(message));
});
}

void Engine::HandleAssetPlatformMessage(
Expand Down
Loading

0 comments on commit bc2acf7

Please sign in to comment.