diff --git a/assets/asset_manager.cc b/assets/asset_manager.cc index 60d169a31ebb2..febff69a94216 100644 --- a/assets/asset_manager.cc +++ b/assets/asset_manager.cc @@ -35,8 +35,8 @@ std::unique_ptr AssetManager::GetAsMapping( if (asset_name.size() == 0) { return nullptr; } - TRACE_EVENT1("flutter", "AssetManager::GetAsMapping", "name", - asset_name.c_str()); + FML_TRACE_EVENT1("flutter", "AssetManager::GetAsMapping", "name", + asset_name.c_str()); for (const auto& resolver : resolvers_) { auto mapping = resolver->GetAsMapping(asset_name); if (mapping != nullptr) { diff --git a/assets/zip_asset_store.cc b/assets/zip_asset_store.cc index 44815a96b5c17..864d8a69f36c6 100644 --- a/assets/zip_asset_store.cc +++ b/assets/zip_asset_store.cc @@ -41,8 +41,8 @@ bool ZipAssetStore::IsValid() const { // |AssetResolver| std::unique_ptr ZipAssetStore::GetAsMapping( const std::string& asset_name) const { - TRACE_EVENT1("flutter", "ZipAssetStore::GetAsMapping", "name", - asset_name.c_str()); + FML_TRACE_EVENT1("flutter", "ZipAssetStore::GetAsMapping", "name", + asset_name.c_str()); auto found = stat_cache_.find(directory_ + "/" + asset_name); if (found == stat_cache_.end()) { @@ -84,7 +84,7 @@ std::unique_ptr ZipAssetStore::GetAsMapping( } void ZipAssetStore::BuildStatCache() { - TRACE_EVENT0("flutter", "ZipAssetStore::BuildStatCache"); + FML_TRACE_EVENT0("flutter", "ZipAssetStore::BuildStatCache"); auto unzipper = CreateUnzipper(); diff --git a/flow/layers/backdrop_filter_layer.cc b/flow/layers/backdrop_filter_layer.cc index cfa678e39ef53..d145d1c8f2e11 100644 --- a/flow/layers/backdrop_filter_layer.cc +++ b/flow/layers/backdrop_filter_layer.cc @@ -11,7 +11,7 @@ BackdropFilterLayer::BackdropFilterLayer() = default; BackdropFilterLayer::~BackdropFilterLayer() = default; void BackdropFilterLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "BackdropFilterLayer::Paint"); + FML_TRACE_EVENT0("flutter", "BackdropFilterLayer::Paint"); FML_DCHECK(needs_painting()); Layer::AutoSaveLayer save = Layer::AutoSaveLayer::Create( diff --git a/flow/layers/clip_path_layer.cc b/flow/layers/clip_path_layer.cc index cdca4619a3707..38e50a9ec5133 100644 --- a/flow/layers/clip_path_layer.cc +++ b/flow/layers/clip_path_layer.cc @@ -54,7 +54,7 @@ void ClipPathLayer::UpdateScene(SceneUpdateContext& context) { #endif // defined(OS_FUCHSIA) void ClipPathLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "ClipPathLayer::Paint"); + FML_TRACE_EVENT0("flutter", "ClipPathLayer::Paint"); FML_DCHECK(needs_painting()); SkAutoCanvasRestore save(context.internal_nodes_canvas, true); diff --git a/flow/layers/clip_rect_layer.cc b/flow/layers/clip_rect_layer.cc index 3f41d8768c6b3..64c77a80a16c0 100644 --- a/flow/layers/clip_rect_layer.cc +++ b/flow/layers/clip_rect_layer.cc @@ -44,7 +44,7 @@ void ClipRectLayer::UpdateScene(SceneUpdateContext& context) { #endif // defined(OS_FUCHSIA) void ClipRectLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "ClipRectLayer::Paint"); + FML_TRACE_EVENT0("flutter", "ClipRectLayer::Paint"); FML_DCHECK(needs_painting()); SkAutoCanvasRestore save(context.internal_nodes_canvas, true); diff --git a/flow/layers/clip_rrect_layer.cc b/flow/layers/clip_rrect_layer.cc index d387f58b1dc72..5d1e1233e7142 100644 --- a/flow/layers/clip_rrect_layer.cc +++ b/flow/layers/clip_rrect_layer.cc @@ -52,7 +52,7 @@ void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) { #endif // defined(OS_FUCHSIA) void ClipRRectLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "ClipRRectLayer::Paint"); + FML_TRACE_EVENT0("flutter", "ClipRRectLayer::Paint"); FML_DCHECK(needs_painting()); SkAutoCanvasRestore save(context.internal_nodes_canvas, true); diff --git a/flow/layers/color_filter_layer.cc b/flow/layers/color_filter_layer.cc index c52bcdc28f407..1f96231736e53 100644 --- a/flow/layers/color_filter_layer.cc +++ b/flow/layers/color_filter_layer.cc @@ -11,7 +11,7 @@ ColorFilterLayer::ColorFilterLayer() = default; ColorFilterLayer::~ColorFilterLayer() = default; void ColorFilterLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "ColorFilterLayer::Paint"); + FML_TRACE_EVENT0("flutter", "ColorFilterLayer::Paint"); FML_DCHECK(needs_painting()); SkPaint paint; diff --git a/flow/layers/container_layer.cc b/flow/layers/container_layer.cc index 31a5a255afca9..ff804c8e134a6 100644 --- a/flow/layers/container_layer.cc +++ b/flow/layers/container_layer.cc @@ -16,7 +16,7 @@ void ContainerLayer::Add(std::shared_ptr layer) { } void ContainerLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { - TRACE_EVENT0("flutter", "ContainerLayer::Preroll"); + FML_TRACE_EVENT0("flutter", "ContainerLayer::Preroll"); SkRect child_paint_bounds = SkRect::MakeEmpty(); PrerollChildren(context, matrix, &child_paint_bounds); diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 70c21604dedb3..6dd09613895bd 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -21,7 +21,7 @@ LayerTree::~LayerTree() = default; void LayerTree::Preroll(CompositorContext::ScopedFrame& frame, bool ignore_raster_cache) { - TRACE_EVENT0("flutter", "LayerTree::Preroll"); + FML_TRACE_EVENT0("flutter", "LayerTree::Preroll"); SkColorSpace* color_space = frame.canvas() ? frame.canvas()->imageInfo().colorSpace() : nullptr; frame.context().raster_cache().SetCheckboardCacheImages( @@ -43,7 +43,7 @@ void LayerTree::Preroll(CompositorContext::ScopedFrame& frame, #if defined(OS_FUCHSIA) void LayerTree::UpdateScene(SceneUpdateContext& context, scenic::ContainerNode& container) { - TRACE_EVENT0("flutter", "LayerTree::UpdateScene"); + FML_TRACE_EVENT0("flutter", "LayerTree::UpdateScene"); const auto& metrics = context.metrics(); SceneUpdateContext::Transform transform(context, // context 1.0f / metrics->scale_x, // X @@ -67,7 +67,7 @@ void LayerTree::UpdateScene(SceneUpdateContext& context, void LayerTree::Paint(CompositorContext::ScopedFrame& frame, bool ignore_raster_cache) const { - TRACE_EVENT0("flutter", "LayerTree::Paint"); + FML_TRACE_EVENT0("flutter", "LayerTree::Paint"); SkISize canvas_size = frame.canvas()->getBaseLayerSize(); SkNWayCanvas internal_nodes_canvas(canvas_size.width(), canvas_size.height()); internal_nodes_canvas.addCanvas(frame.canvas()); @@ -94,7 +94,7 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame, } sk_sp LayerTree::Flatten(const SkRect& bounds) { - TRACE_EVENT0("flutter", "LayerTree::Flatten"); + FML_TRACE_EVENT0("flutter", "LayerTree::Flatten"); SkPictureRecorder recorder; auto* canvas = recorder.beginRecording(bounds); diff --git a/flow/layers/opacity_layer.cc b/flow/layers/opacity_layer.cc index 2af6cb29be3f1..6a60491231b17 100644 --- a/flow/layers/opacity_layer.cc +++ b/flow/layers/opacity_layer.cc @@ -54,7 +54,7 @@ void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { } void OpacityLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "OpacityLayer::Paint"); + FML_TRACE_EVENT0("flutter", "OpacityLayer::Paint"); FML_DCHECK(needs_painting()); SkPaint paint; diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index ebb279c966866..aa31581563d2e 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -76,7 +76,7 @@ void PerformanceOverlayLayer::Paint(PaintContext& context) const { if (!options_) return; - TRACE_EVENT0("flutter", "PerformanceOverlayLayer::Paint"); + FML_TRACE_EVENT0("flutter", "PerformanceOverlayLayer::Paint"); SkScalar x = paint_bounds().x() + padding; SkScalar y = paint_bounds().y() + padding; SkScalar width = paint_bounds().width() - (padding * 2); diff --git a/flow/layers/physical_shape_layer.cc b/flow/layers/physical_shape_layer.cc index 60902ea75ae4d..7e03f911a6545 100644 --- a/flow/layers/physical_shape_layer.cc +++ b/flow/layers/physical_shape_layer.cc @@ -134,7 +134,7 @@ void PhysicalShapeLayer::UpdateScene(SceneUpdateContext& context) { #endif // defined(OS_FUCHSIA) void PhysicalShapeLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "PhysicalShapeLayer::Paint"); + FML_TRACE_EVENT0("flutter", "PhysicalShapeLayer::Paint"); FML_DCHECK(needs_painting()); if (elevation_ != 0) { diff --git a/flow/layers/picture_layer.cc b/flow/layers/picture_layer.cc index fc932a5351997..36977f0c2ffa3 100644 --- a/flow/layers/picture_layer.cc +++ b/flow/layers/picture_layer.cc @@ -30,7 +30,7 @@ void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { } void PictureLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "PictureLayer::Paint"); + FML_TRACE_EVENT0("flutter", "PictureLayer::Paint"); FML_DCHECK(picture_.get()); FML_DCHECK(needs_painting()); diff --git a/flow/layers/shader_mask_layer.cc b/flow/layers/shader_mask_layer.cc index d73a65f8a4ebe..b63238b30f520 100644 --- a/flow/layers/shader_mask_layer.cc +++ b/flow/layers/shader_mask_layer.cc @@ -11,7 +11,7 @@ ShaderMaskLayer::ShaderMaskLayer() = default; ShaderMaskLayer::~ShaderMaskLayer() = default; void ShaderMaskLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint"); + FML_TRACE_EVENT0("flutter", "ShaderMaskLayer::Paint"); FML_DCHECK(needs_painting()); Layer::AutoSaveLayer save = diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index 37d5b606258fe..1092a0093b62c 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -61,7 +61,7 @@ void TransformLayer::UpdateScene(SceneUpdateContext& context) { #endif // defined(OS_FUCHSIA) void TransformLayer::Paint(PaintContext& context) const { - TRACE_EVENT0("flutter", "TransformLayer::Paint"); + FML_TRACE_EVENT0("flutter", "TransformLayer::Paint"); FML_DCHECK(needs_painting()); SkAutoCanvasRestore save(context.internal_nodes_canvas, true); diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 4ad18adf172e4..6324d093563e8 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -98,7 +98,7 @@ static RasterCacheResult Rasterize( bool checkerboard, const SkRect& logical_rect, std::function draw_function) { - TRACE_EVENT0("flutter", "RasterCachePopulate"); + FML_TRACE_EVENT0("flutter", "RasterCachePopulate"); SkIRect cache_rect = RasterCache::GetDeviceBounds(logical_rect, ctm); const SkImageInfo image_info = SkImageInfo::MakeN32Premul( diff --git a/flow/scene_update_context.cc b/flow/scene_update_context.cc index 4f07edd43dd3c..bdc3a8200f6d0 100644 --- a/flow/scene_update_context.cc +++ b/flow/scene_update_context.cc @@ -193,7 +193,7 @@ scenic::Image* SceneUpdateContext::GenerateImageIfNeeded( std::vector< std::unique_ptr> SceneUpdateContext::ExecutePaintTasks(CompositorContext::ScopedFrame& frame) { - TRACE_EVENT0("flutter", "SceneUpdateContext::ExecutePaintTasks"); + FML_TRACE_EVENT0("flutter", "SceneUpdateContext::ExecutePaintTasks"); std::vector> surfaces_to_submit; for (auto& task : paint_tasks_) { FML_DCHECK(task.surface); diff --git a/fml/concurrent_message_loop.cc b/fml/concurrent_message_loop.cc index 23c820787faf9..a036b4f1c29c4 100644 --- a/fml/concurrent_message_loop.cc +++ b/fml/concurrent_message_loop.cc @@ -59,7 +59,7 @@ void ConcurrentMessageLoop::WorkerMain() { if (!shutdown_) { wait_condition_.wait(lock); } - TRACE_EVENT0("fml", "ConcurrentWorkerWake"); + FML_TRACE_EVENT0("fml", "ConcurrentWorkerWake"); RunSingleExpiredTaskNow(); } diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index e12923d886a30..1d6d29c6247bb 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -137,7 +137,7 @@ void MessageLoopImpl::RegisterTask(fml::closure task, } void MessageLoopImpl::FlushTasks(FlushType type) { - TRACE_EVENT0("fml", "MessageLoop::FlushTasks"); + FML_TRACE_EVENT0("fml", "MessageLoop::FlushTasks"); std::vector invocations; // We are grabbing this lock here as a proxy to indicate diff --git a/fml/trace_event.h b/fml/trace_event.h index 9f86bcfa04b0c..0f365bfb41add 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -10,24 +10,8 @@ #if defined(OS_FUCHSIA) #if !defined(FUCHSIA_SDK) -// Forward to the system tracing mechanism on Fuchsia. - #include -// TODO(DNO-448): This is disabled because the Fuchsia counter id json parsing -// only handles ints whereas this can produce ints or strings. -#define FML_TRACE_COUNTER(a, b, c, args...) -#define FML_TRACE_EVENT(a, b, args...) TRACE_DURATION(a, b) - -#define TRACE_EVENT0(a, b) TRACE_DURATION(a, b) -#define TRACE_EVENT1(a, b, c, d) TRACE_DURATION(a, b, c, d) -#define TRACE_EVENT2(a, b, c, d, e, f) TRACE_DURATION(a, b, c, d, e, f) -#define TRACE_EVENT_ASYNC_BEGIN0(a, b, c) TRACE_ASYNC_BEGIN(a, b, c) -#define TRACE_EVENT_ASYNC_END0(a, b, c) TRACE_ASYNC_END(a, b, c) -#define TRACE_EVENT_ASYNC_BEGIN1(a, b, c, d, e) TRACE_ASYNC_BEGIN(a, b, c, d, e) -#define TRACE_EVENT_ASYNC_END1(a, b, c, d, e) TRACE_ASYNC_END(a, b, c, d, e) -#define TRACE_EVENT_INSTANT0(a, b) TRACE_INSTANT(a, b, TRACE_SCOPE_THREAD) - #endif // !defined(FUCHSIA_SDK) #endif // defined(OS_FUCHSIA) @@ -41,9 +25,6 @@ #include "flutter/fml/time/time_point.h" #include "third_party/dart/runtime/include/dart_tools_api.h" -#if !defined(OS_FUCHSIA) || defined(FUCHSIA_SDK) -#ifndef TRACE_EVENT_HIDE_MACROS - #define __FML__TOKEN_CAT__(x, y) x##y #define __FML__TOKEN_CAT__2(x, y) __FML__TOKEN_CAT__(x, y) #define __FML__AUTO_TRACE_END(name) \ @@ -52,8 +33,6 @@ // This macro has the FML_ prefix so that it does not collide with the macros // from trace/event.h on Fuchsia. -// -// TODO(chinmaygarde): All macros here should have the FML prefix. #define FML_TRACE_COUNTER(category_group, name, counter_id, arg1, ...) \ ::fml::tracing::TraceCounter((category_group), (name), (counter_id), (arg1), \ __VA_ARGS__); @@ -62,50 +41,48 @@ ::fml::tracing::TraceEvent((category_group), (name), __VA_ARGS__); \ __FML__AUTO_TRACE_END(name) -#define TRACE_EVENT0(category_group, name) \ +#define FML_TRACE_EVENT0(category_group, name) \ ::fml::tracing::TraceEvent0(category_group, name); \ __FML__AUTO_TRACE_END(name) -#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ +#define FML_TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \ ::fml::tracing::TraceEvent1(category_group, name, arg1_name, arg1_val); \ __FML__AUTO_TRACE_END(name) -#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - ::fml::tracing::TraceEvent2(category_group, name, arg1_name, arg1_val, \ - arg2_name, arg2_val); \ +#define FML_TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \ + arg2_val) \ + ::fml::tracing::TraceEvent2(category_group, name, arg1_name, arg1_val, \ + arg2_name, arg2_val); \ __FML__AUTO_TRACE_END(name) -#define TRACE_EVENT_ASYNC_BEGIN0(category_group, name, id) \ +#define FML_TRACE_EVENT_ASYNC_BEGIN0(category_group, name, id) \ ::fml::tracing::TraceEventAsyncBegin0(category_group, name, id); -#define TRACE_EVENT_ASYNC_END0(category_group, name, id) \ +#define FML_TRACE_EVENT_ASYNC_END0(category_group, name, id) \ ::fml::tracing::TraceEventAsyncEnd0(category_group, name, id); -#define TRACE_EVENT_ASYNC_BEGIN1(category_group, name, id, arg1_name, \ - arg1_val) \ +#define FML_TRACE_EVENT_ASYNC_BEGIN1(category_group, name, id, arg1_name, \ + arg1_val) \ ::fml::tracing::TraceEventAsyncBegin1(category_group, name, id, arg1_name, \ arg1_val); -#define TRACE_EVENT_ASYNC_END1(category_group, name, id, arg1_name, arg1_val) \ - ::fml::tracing::TraceEventAsyncEnd1(category_group, name, id, arg1_name, \ +#define FML_TRACE_EVENT_ASYNC_END1(category_group, name, id, arg1_name, \ + arg1_val) \ + ::fml::tracing::TraceEventAsyncEnd1(category_group, name, id, arg1_name, \ arg1_val); -#define TRACE_EVENT_INSTANT0(category_group, name) \ +#define FML_TRACE_EVENT_INSTANT0(category_group, name) \ ::fml::tracing::TraceEventInstant0(category_group, name); -#define TRACE_FLOW_BEGIN(category, name, id) \ +#define FML_TRACE_FLOW_BEGIN(category, name, id) \ ::fml::tracing::TraceEventFlowBegin0(category, name, id); -#define TRACE_FLOW_STEP(category, name, id) \ +#define FML_TRACE_FLOW_STEP(category, name, id) \ ::fml::tracing::TraceEventFlowStep0(category, name, id); -#define TRACE_FLOW_END(category, name, id) \ +#define FML_TRACE_FLOW_END(category, name, id) \ ::fml::tracing::TraceEventFlowEnd0(category, name, id); -#endif // TRACE_EVENT_HIDE_MACROS -#endif // !defined(OS_FUCHSIA) || defined(FUCHSIA_SDK) - namespace fml { namespace tracing { diff --git a/lib/ui/compositing/scene.cc b/lib/ui/compositing/scene.cc index fd3e86c7e5176..907f644f3392f 100644 --- a/lib/ui/compositing/scene.cc +++ b/lib/ui/compositing/scene.cc @@ -54,7 +54,7 @@ void Scene::dispose() { Dart_Handle Scene::toImage(uint32_t width, uint32_t height, Dart_Handle raw_image_callback) { - TRACE_EVENT0("flutter", "Scene::toImage"); + FML_TRACE_EVENT0("flutter", "Scene::toImage"); if (!m_layerTree) { return tonic::ToDart("Scene did not contain a layer tree."); diff --git a/lib/ui/painting/codec.cc b/lib/ui/painting/codec.cc index d8418bd7455ca..b756d9d498e39 100644 --- a/lib/ui/painting/codec.cc +++ b/lib/ui/painting/codec.cc @@ -47,7 +47,7 @@ static void InvokeCodecCallback(fml::RefPtr codec, size_t trace_id) { std::shared_ptr dart_state = callback->dart_state().lock(); if (!dart_state) { - TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); return; } tonic::DartState::Scope scope(dart_state); @@ -56,14 +56,14 @@ static void InvokeCodecCallback(fml::RefPtr codec, } else { DartInvoke(callback->value(), {ToDart(codec)}); } - TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); } static sk_sp DecodeImage(fml::WeakPtr context, sk_sp buffer, size_t trace_id) { - TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); - TRACE_EVENT0("flutter", "DecodeImage"); + FML_TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_EVENT0("flutter", "DecodeImage"); if (buffer == nullptr || buffer->isEmpty()) { return nullptr; @@ -159,8 +159,8 @@ static sk_sp DecodeAndResizeImageToExactSize( SkImageInfo scaledImageInfo, sk_sp buffer, size_t trace_id) { - TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); - TRACE_EVENT0("flutter", "DecodeAndResizeImageToExactSize"); + FML_TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_EVENT0("flutter", "DecodeAndResizeImageToExactSize"); // Do not create a cross context image here, since it can not be resized. sk_sp image = SkImage::MakeFromEncoded(std::move(buffer)); @@ -194,8 +194,8 @@ fml::RefPtr InitCodec(fml::WeakPtr context, const int targetWidth, const int targetHeight, size_t trace_id) { - TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); - TRACE_EVENT0("blink", "InitCodec"); + FML_TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_EVENT0("blink", "InitCodec"); if (buffer == nullptr || buffer->isEmpty()) { FML_LOG(ERROR) << "InitCodec failed - buffer was empty "; @@ -233,8 +233,8 @@ fml::RefPtr InitCodecUncompressed( int targetWidth, int targetHeight, size_t trace_id) { - TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); - TRACE_EVENT0("blink", "InitCodecUncompressed"); + FML_TRACE_FLOW_STEP("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_EVENT0("blink", "InitCodecUncompressed"); if (buffer == nullptr || buffer->isEmpty()) { FML_LOG(ERROR) << "InitCodecUncompressed failed - buffer was empty"; @@ -360,11 +360,11 @@ bool ConvertImageInfo(Dart_Handle image_info_handle, void InstantiateImageCodec(Dart_NativeArguments args) { static size_t trace_counter = 1; const size_t trace_id = trace_counter++; - TRACE_FLOW_BEGIN("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_BEGIN("flutter", kInitCodecTraceTag, trace_id); Dart_Handle callback_handle = Dart_GetNativeArgument(args, 1); if (!Dart_IsClosure(callback_handle)) { - TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); Dart_SetReturnValue(args, ToDart("Callback must be a function")); return; } @@ -374,7 +374,7 @@ void InstantiateImageCodec(Dart_NativeArguments args) { if (!Dart_IsNull(image_info_handle)) { image_info = std::make_unique(); if (!ConvertImageInfo(image_info_handle, args, image_info.get())) { - TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); return; } } @@ -383,7 +383,7 @@ void InstantiateImageCodec(Dart_NativeArguments args) { tonic::Uint8List list = tonic::DartConverter::FromArguments(args, 0, exception); if (exception) { - TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); Dart_SetReturnValue(args, exception); return; } @@ -391,7 +391,7 @@ void InstantiateImageCodec(Dart_NativeArguments args) { if (image_info) { int expected_size = image_info->row_bytes * image_info->sk_info.height(); if (list.num_elements() < expected_size) { - TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kInitCodecTraceTag, trace_id); list.Release(); Dart_SetReturnValue( args, ToDart("Pixel buffer size does not match image size")); @@ -458,7 +458,7 @@ void InvokeNextFrameCallback(fml::RefPtr frameInfo, size_t trace_id) { std::shared_ptr dart_state = callback->dart_state().lock(); if (!dart_state) { - TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); return; } tonic::DartState::Scope scope(dart_state); @@ -467,7 +467,7 @@ void InvokeNextFrameCallback(fml::RefPtr frameInfo, } else { DartInvoke(callback->value(), {ToDart(frameInfo)}); } - TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); } } // namespace @@ -585,16 +585,16 @@ void MultiFrameCodec::GetNextFrameAndInvokeCallback( InvokeNextFrameCallback(frameInfo, std::move(callback), trace_id); })); - TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); } Dart_Handle MultiFrameCodec::getNextFrame(Dart_Handle callback_handle) { static size_t trace_counter = 1; const size_t trace_id = trace_counter++; - TRACE_FLOW_BEGIN("flutter", kCodecNextFrameTraceTag, trace_id); + FML_TRACE_FLOW_BEGIN("flutter", kCodecNextFrameTraceTag, trace_id); if (!Dart_IsClosure(callback_handle)) { - TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); + FML_TRACE_FLOW_END("flutter", kCodecNextFrameTraceTag, trace_id); return ToDart("Callback must be a function"); } diff --git a/lib/ui/painting/image_encoding.cc b/lib/ui/painting/image_encoding.cc index a554264761727..3c0acaef93ce8 100644 --- a/lib/ui/painting/image_encoding.cc +++ b/lib/ui/painting/image_encoding.cc @@ -70,7 +70,7 @@ sk_sp ConvertToRasterImageIfNecessary(sk_sp image, return nullptr; } - TRACE_EVENT0("flutter", __FUNCTION__); + FML_TRACE_EVENT0("flutter", __FUNCTION__); // Create a GPU surface with the context and then do a device to host copy of // image contents. @@ -135,7 +135,7 @@ sk_sp CopyImageByteData(sk_sp raster_image, sk_sp EncodeImage(sk_sp p_image, GrContext* context, ImageByteFormat format) { - TRACE_EVENT0("flutter", __FUNCTION__); + FML_TRACE_EVENT0("flutter", __FUNCTION__); // Check validity of the image. if (p_image == nullptr) { diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 345792cadfc97..fb9aa7b5f4597 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -42,7 +42,7 @@ std::weak_ptr DartIsolate::CreateRootIsolate( Dart_IsolateFlags* flags, fml::closure isolate_create_callback, fml::closure isolate_shutdown_callback) { - TRACE_EVENT0("flutter", "DartIsolate::CreateRootIsolate"); + FML_TRACE_EVENT0("flutter", "DartIsolate::CreateRootIsolate"); Dart_Isolate vm_isolate = nullptr; std::weak_ptr embedder_isolate; @@ -142,7 +142,7 @@ DartIsolate::Phase DartIsolate::GetPhase() const { } bool DartIsolate::Initialize(Dart_Isolate dart_isolate, bool is_root_isolate) { - TRACE_EVENT0("flutter", "DartIsolate::Initialize"); + FML_TRACE_EVENT0("flutter", "DartIsolate::Initialize"); if (phase_ != Phase::Uninitialized) { return false; } @@ -245,7 +245,7 @@ bool DartIsolate::UpdateThreadPoolNames() const { } bool DartIsolate::LoadLibraries(bool is_root_isolate) { - TRACE_EVENT0("flutter", "DartIsolate::LoadLibraries"); + FML_TRACE_EVENT0("flutter", "DartIsolate::LoadLibraries"); if (phase_ != Phase::Initialized) { return false; } @@ -271,7 +271,8 @@ bool DartIsolate::LoadLibraries(bool is_root_isolate) { } bool DartIsolate::PrepareForRunningFromPrecompiledCode() { - TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromPrecompiledCode"); + FML_TRACE_EVENT0("flutter", + "DartIsolate::PrepareForRunningFromPrecompiledCode"); if (phase_ != Phase::LibrariesSetup) { return false; } @@ -329,7 +330,7 @@ FML_WARN_UNUSED_RESULT bool DartIsolate::PrepareForRunningFromKernel( std::shared_ptr mapping, bool last_piece) { - TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromKernel"); + FML_TRACE_EVENT0("flutter", "DartIsolate::PrepareForRunningFromKernel"); if (phase_ != Phase::LibrariesSetup) { return false; } @@ -419,7 +420,7 @@ bool DartIsolate::PrepareForRunningFromKernels( } bool DartIsolate::MarkIsolateRunnable() { - TRACE_EVENT0("flutter", "DartIsolate::MarkIsolateRunnable"); + FML_TRACE_EVENT0("flutter", "DartIsolate::MarkIsolateRunnable"); if (phase_ != Phase::LibrariesSetup) { return false; } @@ -476,7 +477,7 @@ FML_WARN_UNUSED_RESULT bool DartIsolate::Run(const std::string& entrypoint_name, const std::vector& args, fml::closure on_run) { - TRACE_EVENT0("flutter", "DartIsolate::Run"); + FML_TRACE_EVENT0("flutter", "DartIsolate::Run"); if (phase_ != Phase::Ready) { return false; } @@ -506,7 +507,7 @@ bool DartIsolate::RunFromLibrary(const std::string& library_name, const std::string& entrypoint_name, const std::vector& args, fml::closure on_run) { - TRACE_EVENT0("flutter", "DartIsolate::RunFromLibrary"); + FML_TRACE_EVENT0("flutter", "DartIsolate::RunFromLibrary"); if (phase_ != Phase::Ready) { return false; } @@ -533,7 +534,7 @@ bool DartIsolate::RunFromLibrary(const std::string& library_name, } bool DartIsolate::Shutdown() { - TRACE_EVENT0("flutter", "DartIsolate::Shutdown"); + FML_TRACE_EVENT0("flutter", "DartIsolate::Shutdown"); // This call may be re-entrant since Dart_ShutdownIsolate can invoke the // cleanup callback which deletes the embedder side object of the dart isolate // (a.k.a. this). @@ -675,7 +676,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair( std::shared_ptr* p_parent_embedder_isolate, bool is_root_isolate, char** error) { - TRACE_EVENT0("flutter", "DartIsolate::CreateDartVMAndEmbedderObjectPair"); + FML_TRACE_EVENT0("flutter", "DartIsolate::CreateDartVMAndEmbedderObjectPair"); std::unique_ptr> embedder_isolate( p_parent_embedder_isolate); diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index c666d1c236e62..23e5cc1cde060 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -147,7 +147,7 @@ static std::shared_ptr ResolveIsolateInstructions( fml::RefPtr DartSnapshot::VMSnapshotFromSettings( const Settings& settings) { - TRACE_EVENT0("flutter", "DartSnapshot::VMSnapshotFromSettings"); + FML_TRACE_EVENT0("flutter", "DartSnapshot::VMSnapshotFromSettings"); auto snapshot = fml::MakeRefCounted(ResolveVMData(settings), // ResolveVMInstructions(settings) // @@ -160,7 +160,7 @@ fml::RefPtr DartSnapshot::VMSnapshotFromSettings( fml::RefPtr DartSnapshot::IsolateSnapshotFromSettings( const Settings& settings) { - TRACE_EVENT0("flutter", "DartSnapshot::IsolateSnapshotFromSettings"); + FML_TRACE_EVENT0("flutter", "DartSnapshot::IsolateSnapshotFromSettings"); auto snapshot = fml::MakeRefCounted(ResolveIsolateData(settings), // ResolveIsolateInstructions(settings) // diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index a09a87d106012..81542a3249b62 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -259,7 +259,7 @@ DartVM::DartVM(std::shared_ptr vm_data, vm_data_(vm_data), isolate_name_server_(std::move(isolate_name_server)), service_protocol_(std::make_shared()) { - TRACE_EVENT0("flutter", "DartVMInitializer"); + FML_TRACE_EVENT0("flutter", "DartVMInitializer"); gVMLaunchCount++; @@ -271,7 +271,7 @@ DartVM::DartVM(std::shared_ptr vm_data, << (IsRunningPrecompiledCode() ? "AOT" : "Interpreter"); { - TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo"); + FML_TRACE_EVENT0("flutter", "dart::bin::BootstrapDartIo"); dart::bin::BootstrapDartIo(); if (!settings_.temp_directory_path.empty()) { @@ -342,6 +342,9 @@ DartVM::DartVM(std::shared_ptr vm_data, } if (settings_.trace_systrace) { +#if defined(OS_FUCHSIA) + PushBackAll(&args, kDartFuchsiaTraceArgs, fml::size(kDartFuchsiaTraceArgs)); +#endif // OS_FUCHSIA PushBackAll(&args, kDartSystraceTraceBufferArgs, fml::size(kDartSystraceTraceBufferArgs)); PushBackAll(&args, kDartTraceStreamsArgs, fml::size(kDartTraceStreamsArgs)); @@ -351,11 +354,6 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartTraceStartupArgs, fml::size(kDartTraceStartupArgs)); } -#if defined(OS_FUCHSIA) - PushBackAll(&args, kDartFuchsiaTraceArgs, fml::size(kDartFuchsiaTraceArgs)); - PushBackAll(&args, kDartTraceStreamsArgs, fml::size(kDartTraceStreamsArgs)); -#endif - for (size_t i = 0; i < settings_.dart_flags.size(); i++) args.push_back(settings_.dart_flags[i].c_str()); @@ -368,7 +366,7 @@ DartVM::DartVM(std::shared_ptr vm_data, DartUI::InitForGlobal(); { - TRACE_EVENT0("flutter", "Dart_Initialize"); + FML_TRACE_EVENT0("flutter", "Dart_Initialize"); Dart_InitializeParams params = {}; params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; params.vm_snapshot_data = vm_data_->GetVMSnapshot().GetDataMapping(); diff --git a/runtime/runtime_controller.cc b/runtime/runtime_controller.cc index 62c717e0c2779..400b76cf8cd16 100644 --- a/runtime/runtime_controller.cc +++ b/runtime/runtime_controller.cc @@ -243,7 +243,7 @@ bool RuntimeController::NotifyIdle(int64_t deadline) { // Idle notifications being in isolate scope are part of the contract. if (idle_notification_callback_) { - TRACE_EVENT0("flutter", "EmbedderIdleNotification"); + FML_TRACE_EVENT0("flutter", "EmbedderIdleNotification"); idle_notification_callback_(deadline); } return true; @@ -252,8 +252,8 @@ bool RuntimeController::NotifyIdle(int64_t deadline) { bool RuntimeController::DispatchPlatformMessage( fml::RefPtr message) { if (auto* window = GetWindowIfAvailable()) { - TRACE_EVENT1("flutter", "RuntimeController::DispatchPlatformMessage", - "mode", "basic"); + FML_TRACE_EVENT1("flutter", "RuntimeController::DispatchPlatformMessage", + "mode", "basic"); window->DispatchPlatformMessage(std::move(message)); return true; } @@ -263,8 +263,8 @@ bool RuntimeController::DispatchPlatformMessage( bool RuntimeController::DispatchPointerDataPacket( const PointerDataPacket& packet) { if (auto* window = GetWindowIfAvailable()) { - TRACE_EVENT1("flutter", "RuntimeController::DispatchPointerDataPacket", - "mode", "basic"); + FML_TRACE_EVENT1("flutter", "RuntimeController::DispatchPointerDataPacket", + "mode", "basic"); window->DispatchPointerDataPacket(packet); return true; } @@ -274,8 +274,8 @@ bool RuntimeController::DispatchPointerDataPacket( bool RuntimeController::DispatchSemanticsAction(int32_t id, SemanticsAction action, std::vector args) { - TRACE_EVENT1("flutter", "RuntimeController::DispatchSemanticsAction", "mode", - "basic"); + FML_TRACE_EVENT1("flutter", "RuntimeController::DispatchSemanticsAction", + "mode", "basic"); if (auto* window = GetWindowIfAvailable()) { window->DispatchSemanticsAction(id, action, std::move(args)); return true; diff --git a/shell/common/animator.cc b/shell/common/animator.cc index 2defe146a8666..566b71dbef649 100644 --- a/shell/common/animator.cc +++ b/shell/common/animator.cc @@ -94,12 +94,13 @@ static int64_t FxlToDartOrEarlier(fml::TimePoint time) { void Animator::BeginFrame(fml::TimePoint frame_start_time, fml::TimePoint frame_target_time) { - TRACE_EVENT_ASYNC_END0("flutter", "Frame Request Pending", frame_number_++); + FML_TRACE_EVENT_ASYNC_END0("flutter", "Frame Request Pending", + frame_number_++); - TRACE_EVENT0("flutter", "Animator::BeginFrame"); + FML_TRACE_EVENT0("flutter", "Animator::BeginFrame"); while (!trace_flow_ids_.empty()) { uint64_t trace_flow_id = trace_flow_ids_.front(); - TRACE_FLOW_END("flutter", "PointerEvent", trace_flow_id); + FML_TRACE_FLOW_END("flutter", "PointerEvent", trace_flow_id); trace_flow_ids_.pop_front(); } @@ -130,8 +131,8 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, last_begin_frame_time_ = frame_start_time; dart_frame_deadline_ = FxlToDartOrEarlier(frame_target_time); { - TRACE_EVENT2("flutter", "Framework Workload", "mode", "basic", "frame", - FrameParity()); + FML_TRACE_EVENT2("flutter", "Framework Workload", "mode", "basic", "frame", + FrameParity()); delegate_.OnAnimatorBeginFrame(last_begin_frame_time_); } @@ -155,7 +156,7 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time, // assume that we are idle, and notify the engine of this. if (notify_idle_task_id == self->notify_idle_task_id_ && !self->frame_scheduled_) { - TRACE_EVENT0("flutter", "BeginFrame idle callback"); + FML_TRACE_EVENT0("flutter", "BeginFrame idle callback"); self->delegate_.OnAnimatorNotifyIdle(Dart_TimelineGetMicros() + 100000); } @@ -213,14 +214,15 @@ 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. - task_runners_.GetUITaskRunner()->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(); - }); + task_runners_.GetUITaskRunner()->PostTask( + [self = weak_factory_.GetWeakPtr(), frame_number = frame_number_]() { + if (!self.get()) { + return; + } + FML_TRACE_EVENT_ASYNC_BEGIN0("flutter", "Frame Request Pending", + frame_number); + self->AwaitVSync(); + }); frame_scheduled_ = true; } diff --git a/shell/common/engine.cc b/shell/common/engine.cc index c1043c3877550..7219689e37144 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -101,7 +101,7 @@ bool Engine::UpdateAssetManager( } bool Engine::Restart(RunConfiguration configuration) { - TRACE_EVENT0("flutter", "Engine::Restart"); + FML_TRACE_EVENT0("flutter", "Engine::Restart"); if (!configuration.IsValid()) { FML_LOG(ERROR) << "Engine run configuration was invalid."; return false; @@ -153,7 +153,7 @@ Engine::RunStatus Engine::Run(RunConfiguration configuration) { Engine::RunStatus Engine::PrepareAndLaunchIsolate( RunConfiguration configuration) { - TRACE_EVENT0("flutter", "Engine::PrepareAndLaunchIsolate"); + FML_TRACE_EVENT0("flutter", "Engine::PrepareAndLaunchIsolate"); UpdateAssetManager(configuration.GetAssetManager()); @@ -197,13 +197,13 @@ Engine::RunStatus Engine::PrepareAndLaunchIsolate( } void Engine::BeginFrame(fml::TimePoint frame_time) { - TRACE_EVENT0("flutter", "Engine::BeginFrame"); + FML_TRACE_EVENT0("flutter", "Engine::BeginFrame"); runtime_controller_->BeginFrame(frame_time); } void Engine::NotifyIdle(int64_t deadline) { - TRACE_EVENT1("flutter", "Engine::NotifyIdle", "deadline_now_delta", - std::to_string(deadline - Dart_TimelineGetMicros()).c_str()); + FML_TRACE_EVENT1("flutter", "Engine::NotifyIdle", "deadline_now_delta", + std::to_string(deadline - Dart_TimelineGetMicros()).c_str()); runtime_controller_->NotifyIdle(deadline); } @@ -361,8 +361,8 @@ void Engine::HandleSettingsPlatformMessage(PlatformMessage* message) { void Engine::DispatchPointerDataPacket(const PointerDataPacket& packet, uint64_t trace_flow_id) { - TRACE_EVENT0("flutter", "Engine::DispatchPointerDataPacket"); - TRACE_FLOW_STEP("flutter", "PointerEvent", trace_flow_id); + FML_TRACE_EVENT0("flutter", "Engine::DispatchPointerDataPacket"); + FML_TRACE_FLOW_STEP("flutter", "PointerEvent", trace_flow_id); animator_->EnqueueTraceFlowId(trace_flow_id); runtime_controller_->DispatchPointerDataPacket(packet); } diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index ce2b380cd1adc..21f9c291886a6 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -79,7 +79,7 @@ bool PersistentCache::IsValid() const { // |GrContextOptions::PersistentCache| sk_sp PersistentCache::load(const SkData& key) { - TRACE_EVENT0("flutter", "PersistentCacheLoad"); + FML_TRACE_EVENT0("flutter", "PersistentCacheLoad"); if (!IsValid()) { return nullptr; } @@ -97,7 +97,7 @@ sk_sp PersistentCache::load(const SkData& key) { return nullptr; } - TRACE_EVENT0("flutter", "PersistentCacheLoadHit"); + FML_TRACE_EVENT0("flutter", "PersistentCacheLoadHit"); return SkData::MakeWithCopy(mapping->GetMapping(), mapping->GetSize()); } @@ -110,7 +110,7 @@ static void PersistentCacheStore(fml::RefPtr worker, file_name = std::move(key), // mapping = std::move(value) // ]() mutable { - TRACE_EVENT0("flutter", "PersistentCacheStore"); + FML_TRACE_EVENT0("flutter", "PersistentCacheStore"); if (!fml::WriteAtomically(*cache_directory, // file_name.c_str(), // *mapping) // diff --git a/shell/common/pipeline.h b/shell/common/pipeline.h index b9aa1d89c6cb5..cf959eaa20012 100644 --- a/shell/common/pipeline.h +++ b/shell/common/pipeline.h @@ -51,10 +51,10 @@ class Pipeline : public fml::RefCountedThreadSafe> { ~ProducerContinuation() { if (continuation_) { continuation_(nullptr, trace_id_); - TRACE_EVENT_ASYNC_END0("flutter", "PipelineProduce", trace_id_); + FML_TRACE_EVENT_ASYNC_END0("flutter", "PipelineProduce", trace_id_); // The continuation is being dropped on the floor. End the flow. - TRACE_FLOW_END("flutter", "PipelineItem", trace_id_); - TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id_); + FML_TRACE_FLOW_END("flutter", "PipelineItem", trace_id_); + FML_TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id_); } } @@ -62,8 +62,8 @@ class Pipeline : public fml::RefCountedThreadSafe> { if (continuation_) { continuation_(std::move(resource), trace_id_); continuation_ = nullptr; - TRACE_EVENT_ASYNC_END0("flutter", "PipelineProduce", trace_id_); - TRACE_FLOW_STEP("flutter", "PipelineItem", trace_id_); + FML_TRACE_EVENT_ASYNC_END0("flutter", "PipelineProduce", trace_id_); + FML_TRACE_FLOW_STEP("flutter", "PipelineItem", trace_id_); } } @@ -78,9 +78,9 @@ class Pipeline : public fml::RefCountedThreadSafe> { ProducerContinuation(Continuation continuation, size_t trace_id) : continuation_(continuation), trace_id_(trace_id) { - TRACE_FLOW_BEGIN("flutter", "PipelineItem", trace_id_); - TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineItem", trace_id_); - TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineProduce", trace_id_); + FML_TRACE_FLOW_BEGIN("flutter", "PipelineItem", trace_id_); + FML_TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineItem", trace_id_); + FML_TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineProduce", trace_id_); } FML_DISALLOW_COPY_AND_ASSIGN(ProducerContinuation); @@ -127,14 +127,14 @@ class Pipeline : public fml::RefCountedThreadSafe> { } { - TRACE_EVENT0("flutter", "PipelineConsume"); + FML_TRACE_EVENT0("flutter", "PipelineConsume"); consumer(std::move(resource)); } empty_.Signal(); - TRACE_FLOW_END("flutter", "PipelineItem", trace_id); - TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id); + FML_TRACE_FLOW_END("flutter", "PipelineItem", trace_id); + FML_TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id); return items_count > 0 ? PipelineConsumeResult::MoreAvailable : PipelineConsumeResult::Done; diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index fd0296b1c4125..916b6c5ca2b2d 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -72,7 +72,7 @@ void Rasterizer::DrawLastLayerTree() { } void Rasterizer::Draw(fml::RefPtr> pipeline) { - TRACE_EVENT0("flutter", "GPURasterizer::Draw"); + FML_TRACE_EVENT0("flutter", "GPURasterizer::Draw"); Pipeline::Consumer consumer = std::bind(&Rasterizer::DoDraw, this, std::placeholders::_1); @@ -96,7 +96,7 @@ void Rasterizer::Draw(fml::RefPtr> pipeline) { sk_sp Rasterizer::MakeRasterSnapshot(sk_sp picture, SkISize picture_size) { - TRACE_EVENT0("flutter", __FUNCTION__); + FML_TRACE_EVENT0("flutter", __FUNCTION__); sk_sp surface; SkImageInfo image_info = SkImageInfo::MakeN32Premul( @@ -128,7 +128,7 @@ sk_sp Rasterizer::MakeRasterSnapshot(sk_sp picture, sk_sp device_snapshot; { - TRACE_EVENT0("flutter", "MakeDeviceSnpashot"); + FML_TRACE_EVENT0("flutter", "MakeDeviceSnpashot"); device_snapshot = surface->makeImageSnapshot(); } @@ -137,7 +137,7 @@ sk_sp Rasterizer::MakeRasterSnapshot(sk_sp picture, } { - TRACE_EVENT0("flutter", "DeviceHostTransfer"); + FML_TRACE_EVENT0("flutter", "DeviceHostTransfer"); if (auto raster_image = device_snapshot->makeRasterImage()) { return raster_image; } diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 7bb1b6ce8bd14..1369b40aa8056 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -78,7 +78,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( &platform_view, // io_task_runner // ]() { - TRACE_EVENT0("flutter", "ShellSetupIOSubsystem"); + FML_TRACE_EVENT0("flutter", "ShellSetupIOSubsystem"); io_manager = std::make_unique( platform_view->CreateResourceContext(), io_task_runner); io_latch.Signal(); @@ -96,7 +96,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( shell = shell.get(), // &snapshot_delegate // ]() { - TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem"); + FML_TRACE_EVENT0("flutter", "ShellSetupGPUSubsystem"); if (auto new_rasterizer = on_create_rasterizer(*shell)) { rasterizer = std::move(new_rasterizer); snapshot_delegate = rasterizer->GetSnapshotDelegate(); @@ -120,7 +120,7 @@ std::unique_ptr Shell::CreateShellOnPlatformThread( snapshot_delegate = std::move(snapshot_delegate), // io_manager = io_manager->GetWeakPtr() // ]() mutable { - TRACE_EVENT0("flutter", "ShellSetupUISubsystem"); + FML_TRACE_EVENT0("flutter", "ShellSetupUISubsystem"); const auto& task_runners = shell->GetTaskRunners(); // The animator is owned by the UI thread but it gets its vsync pulses @@ -212,7 +212,7 @@ std::unique_ptr Shell::Create( Shell::CreateCallback on_create_rasterizer) { PerformInitializationTasks(settings); - TRACE_EVENT0("flutter", "Shell::Create"); + FML_TRACE_EVENT0("flutter", "Shell::Create"); auto vm = DartVMRef::Create(settings); FML_CHECK(vm) << "Must be able to initialize the VM."; @@ -239,7 +239,7 @@ std::unique_ptr Shell::Create( DartVMRef vm) { PerformInitializationTasks(settings); - TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); + FML_TRACE_EVENT0("flutter", "Shell::CreateWithSnapshots"); if (!task_runners.IsValid() || !on_create_platform_view || !on_create_rasterizer) { @@ -431,7 +431,7 @@ DartVM* Shell::GetDartVM() { // |PlatformView::Delegate| void Shell::OnPlatformViewCreated(std::unique_ptr surface) { - TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated"); + FML_TRACE_EVENT0("flutter", "Shell::OnPlatformViewCreated"); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -515,7 +515,7 @@ void Shell::OnPlatformViewCreated(std::unique_ptr surface) { // |PlatformView::Delegate| void Shell::OnPlatformViewDestroyed() { - TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed"); + FML_TRACE_EVENT0("flutter", "Shell::OnPlatformViewDestroyed"); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); @@ -617,8 +617,8 @@ void Shell::OnPlatformViewDispatchPlatformMessage( // |PlatformView::Delegate| void Shell::OnPlatformViewDispatchPointerDataPacket( std::unique_ptr packet) { - TRACE_EVENT0("flutter", "Shell::OnPlatformViewDispatchPointerDataPacket"); - TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); + FML_TRACE_EVENT0("flutter", "Shell::OnPlatformViewDispatchPointerDataPacket"); + FML_TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); FML_DCHECK(is_setup_); FML_DCHECK(task_runners_.GetPlatformTaskRunner()->RunsTasksOnCurrentThread()); task_runners_.GetUITaskRunner()->PostTask(fml::MakeCopyable( @@ -1108,7 +1108,7 @@ bool Shell::OnServiceProtocolSetAssetBundlePath( Rasterizer::Screenshot Shell::Screenshot( Rasterizer::ScreenshotType screenshot_type, bool base64_encode) { - TRACE_EVENT0("flutter", "Shell::Screenshot"); + FML_TRACE_EVENT0("flutter", "Shell::Screenshot"); fml::AutoResetWaitableEvent latch; Rasterizer::Screenshot screenshot; fml::TaskRunner::RunNowOrPostTask( diff --git a/shell/common/skia_event_tracer_impl.cc b/shell/common/skia_event_tracer_impl.cc index 514e4e7f3d002..c0562bee25c77 100644 --- a/shell/common/skia_event_tracer_impl.cc +++ b/shell/common/skia_event_tracer_impl.cc @@ -4,7 +4,7 @@ #include "flutter/shell/common/skia_event_tracer_impl.h" -#define TRACE_EVENT_HIDE_MACROS +#define FML_TRACE_EVENT_HIDE_MACROS #include #include "flutter/fml/logging.h" diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 97364c581d2ee..7fd86cfba9885 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -34,7 +34,7 @@ void VsyncWaiter::AsyncWaitForVsync(Callback callback) { return; } - TRACE_EVENT0("flutter", "AsyncWaitForVsync"); + FML_TRACE_EVENT0("flutter", "AsyncWaitForVsync"); { std::lock_guard lock(callback_mutex_); @@ -42,7 +42,8 @@ void VsyncWaiter::AsyncWaitForVsync(Callback callback) { // The animator may request a frame more than once within a frame // interval. Multiple calls to request frame must result in a single // callback per frame interval. - TRACE_EVENT_INSTANT0("flutter", "MultipleCallsToVsyncInFrameInterval"); + FML_TRACE_EVENT_INSTANT0("flutter", + "MultipleCallsToVsyncInFrameInterval"); return; } callback_ = std::move(callback); @@ -63,7 +64,7 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, // This means that the vsync waiter implementation fired a callback for a // request we did not make. This is a paranoid check but we still want to // make sure we catch misbehaving vsync implementations. - TRACE_EVENT_INSTANT0("flutter", "MismatchedFrameCallback"); + FML_TRACE_EVENT_INSTANT0("flutter", "MismatchedFrameCallback"); return; } @@ -73,9 +74,9 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, // exist. The trace viewer will ignore traces that have no base event trace. // While all our message loops insert a base trace trace // (MessageLoop::RunExpiredTasks), embedders may not. - TRACE_EVENT0("flutter", "VsyncFireCallback"); + FML_TRACE_EVENT0("flutter", "VsyncFireCallback"); - TRACE_FLOW_BEGIN("flutter", kVsyncFlowName, flow_identifier); + FML_TRACE_FLOW_BEGIN("flutter", kVsyncFlowName, flow_identifier); task_runners_.GetUITaskRunner()->PostTaskForTime( [callback, flow_identifier, frame_start_time, frame_target_time]() { @@ -85,7 +86,7 @@ void VsyncWaiter::FireCallback(fml::TimePoint frame_start_time, "flutter", "VsyncSchedulingOverhead", fml::TimePoint::Now(), frame_start_time); callback(frame_start_time, frame_target_time); - TRACE_FLOW_END("flutter", kVsyncFlowName, flow_identifier); + FML_TRACE_FLOW_END("flutter", kVsyncFlowName, flow_identifier); }, frame_start_time); } diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index d344e7225a595..ef09ceb64e5a2 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -176,7 +176,7 @@ bool GPUSurfaceGL::CreateOrUpdateSurfaces(const SkISize& size) { } // We need to do some updates. - TRACE_EVENT0("flutter", "UpdateSurfacesSize"); + FML_TRACE_EVENT0("flutter", "UpdateSurfacesSize"); // Either way, we need to get rid of previous surface. onscreen_surface_ = nullptr; @@ -259,7 +259,7 @@ bool GPUSurfaceGL::PresentSurface(SkCanvas* canvas) { } if (offscreen_surface_ != nullptr) { - TRACE_EVENT0("flutter", "CopyTextureOnscreen"); + FML_TRACE_EVENT0("flutter", "CopyTextureOnscreen"); SkPaint paint; SkCanvas* onscreen_canvas = onscreen_surface_->getCanvas(); onscreen_canvas->clear(SK_ColorTRANSPARENT); @@ -268,7 +268,7 @@ bool GPUSurfaceGL::PresentSurface(SkCanvas* canvas) { } { - TRACE_EVENT0("flutter", "SkCanvas::Flush"); + FML_TRACE_EVENT0("flutter", "SkCanvas::Flush"); onscreen_surface_->getCanvas()->flush(); } diff --git a/shell/platform/android/android_context_gl.cc b/shell/platform/android/android_context_gl.cc index d3fd715a38abc..672a956cf8f8e 100644 --- a/shell/platform/android/android_context_gl.cc +++ b/shell/platform/android/android_context_gl.cc @@ -235,7 +235,7 @@ bool AndroidContextGL::ClearCurrent() { } bool AndroidContextGL::SwapBuffers() { - TRACE_EVENT0("flutter", "AndroidContextGL::SwapBuffers"); + FML_TRACE_EVENT0("flutter", "AndroidContextGL::SwapBuffers"); return eglSwapBuffers(environment_->Display(), surface_); } diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index 931d09b933fdc..3ea3af935d68c 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -192,8 +192,8 @@ void AndroidShellHolder::DispatchPointerDataPacket( return; } - TRACE_EVENT0("flutter", "AndroidShellHolder::DispatchPointerDataPacket"); - TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); + FML_TRACE_EVENT0("flutter", "AndroidShellHolder::DispatchPointerDataPacket"); + FML_TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); shell_->GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( [engine = shell_->GetEngine(), packet = std::move(packet), diff --git a/shell/platform/android/android_surface_software.cc b/shell/platform/android/android_surface_software.cc index 633b6091f0c15..481cc540dc10e 100644 --- a/shell/platform/android/android_surface_software.cc +++ b/shell/platform/android/android_surface_software.cc @@ -72,7 +72,7 @@ std::unique_ptr AndroidSurfaceSoftware::CreateGPUSurface() { sk_sp AndroidSurfaceSoftware::AcquireBackingStore( const SkISize& size) { - TRACE_EVENT0("flutter", "AndroidSurfaceSoftware::AcquireBackingStore"); + FML_TRACE_EVENT0("flutter", "AndroidSurfaceSoftware::AcquireBackingStore"); if (!IsValid()) { return nullptr; } @@ -94,7 +94,7 @@ sk_sp AndroidSurfaceSoftware::AcquireBackingStore( bool AndroidSurfaceSoftware::PresentBackingStore( sk_sp backing_store) { - TRACE_EVENT0("flutter", "AndroidSurfaceSoftware::PresentBackingStore"); + FML_TRACE_EVENT0("flutter", "AndroidSurfaceSoftware::PresentBackingStore"); if (!IsValid() || backing_store == nullptr) { return false; } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index f99c346ea1632..527e4b2e937c0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -120,8 +120,8 @@ - (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics { } - (void)dispatchPointerDataPacket:(std::unique_ptr)packet { - TRACE_EVENT0("flutter", "dispatchPointerDataPacket"); - TRACE_FLOW_BEGIN("flutter", "PointerEvent", _nextPointerFlowId); + FML_TRACE_EVENT0("flutter", "dispatchPointerDataPacket"); + FML_TRACE_FLOW_BEGIN("flutter", "PointerEvent", _nextPointerFlowId); self.shell.GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( [engine = self.shell.GetEngine(), packet = std::move(packet), flow_id = _nextPointerFlowId] { if (engine) { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/shell/platform/darwin/ios/framework/Source/FlutterView.mm index 0d53b44b70d31..9527c0e769de0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -120,7 +120,7 @@ + (Class)layerClass { } - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context { - TRACE_EVENT0("flutter", "SnapshotFlutterView"); + FML_TRACE_EVENT0("flutter", "SnapshotFlutterView"); if (layer != self.layer || context == nullptr) { return; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index fc08125a18aee..37086e9bbdc91 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -394,7 +394,7 @@ - (void)surfaceUpdated:(BOOL)appeared { #pragma mark - UIViewController lifecycle notifications - (void)viewWillAppear:(BOOL)animated { - TRACE_EVENT0("flutter", "viewWillAppear"); + FML_TRACE_EVENT0("flutter", "viewWillAppear"); if (_engineNeedsLaunch) { [_engine.get() launchEngine:nil libraryURI:nil]; @@ -412,7 +412,7 @@ - (void)viewWillAppear:(BOOL)animated { } - (void)viewDidAppear:(BOOL)animated { - TRACE_EVENT0("flutter", "viewDidAppear"); + FML_TRACE_EVENT0("flutter", "viewDidAppear"); [self onLocaleUpdated:nil]; [self onUserSettingsChanged:nil]; [self onAccessibilityStatusChanged:nil]; @@ -422,14 +422,14 @@ - (void)viewDidAppear:(BOOL)animated { } - (void)viewWillDisappear:(BOOL)animated { - TRACE_EVENT0("flutter", "viewWillDisappear"); + FML_TRACE_EVENT0("flutter", "viewWillDisappear"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; [super viewWillDisappear:animated]; } - (void)viewDidDisappear:(BOOL)animated { - TRACE_EVENT0("flutter", "viewDidDisappear"); + FML_TRACE_EVENT0("flutter", "viewDidDisappear"); [self surfaceUpdated:NO]; [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"]; [self flushOngoingTouches]; @@ -479,25 +479,25 @@ - (void)dealloc { #pragma mark - Application lifecycle notifications - (void)applicationBecameActive:(NSNotification*)notification { - TRACE_EVENT0("flutter", "applicationBecameActive"); + FML_TRACE_EVENT0("flutter", "applicationBecameActive"); if (_viewportMetrics.physical_width) [self surfaceUpdated:YES]; [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.resumed"]; } - (void)applicationWillResignActive:(NSNotification*)notification { - TRACE_EVENT0("flutter", "applicationWillResignActive"); + FML_TRACE_EVENT0("flutter", "applicationWillResignActive"); [self surfaceUpdated:NO]; [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; } - (void)applicationDidEnterBackground:(NSNotification*)notification { - TRACE_EVENT0("flutter", "applicationDidEnterBackground"); + FML_TRACE_EVENT0("flutter", "applicationDidEnterBackground"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"]; } - (void)applicationWillEnterForeground:(NSNotification*)notification { - TRACE_EVENT0("flutter", "applicationWillEnterForeground"); + FML_TRACE_EVENT0("flutter", "applicationWillEnterForeground"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; } diff --git a/shell/platform/darwin/ios/ios_gl_render_target.mm b/shell/platform/darwin/ios/ios_gl_render_target.mm index 1401707b28891..a02a8e9cc36f8 100644 --- a/shell/platform/darwin/ios/ios_gl_render_target.mm +++ b/shell/platform/darwin/ios/ios_gl_render_target.mm @@ -98,7 +98,7 @@ // Nothing to since the stoage size is already consistent with the layer. return true; } - TRACE_EVENT_INSTANT0("flutter", "IOSGLRenderTarget::UpdateStorageSizeIfNecessary"); + FML_TRACE_EVENT_INSTANT0("flutter", "IOSGLRenderTarget::UpdateStorageSizeIfNecessary"); FML_DLOG(INFO) << "Updating render buffer storage size."; FML_DCHECK(glGetError() == GL_NO_ERROR); diff --git a/shell/platform/darwin/ios/ios_surface_gl.mm b/shell/platform/darwin/ios/ios_surface_gl.mm index f9279cc5116fe..37a1052f557f9 100644 --- a/shell/platform/darwin/ios/ios_surface_gl.mm +++ b/shell/platform/darwin/ios/ios_surface_gl.mm @@ -70,7 +70,7 @@ } bool IOSSurfaceGL::GLContextPresent() { - TRACE_EVENT0("flutter", "IOSSurfaceGL::GLContextPresent"); + FML_TRACE_EVENT0("flutter", "IOSSurfaceGL::GLContextPresent"); return IsValid() && render_target_->PresentRenderBuffer(); } diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm index 32cb5a2bbeef1..65d462ee69359 100644 --- a/shell/platform/darwin/ios/ios_surface_software.mm +++ b/shell/platform/darwin/ios/ios_surface_software.mm @@ -53,7 +53,7 @@ } sk_sp IOSSurfaceSoftware::AcquireBackingStore(const SkISize& size) { - TRACE_EVENT0("flutter", "IOSSurfaceSoftware::AcquireBackingStore"); + FML_TRACE_EVENT0("flutter", "IOSSurfaceSoftware::AcquireBackingStore"); if (!IsValid()) { return nullptr; } @@ -71,7 +71,7 @@ } bool IOSSurfaceSoftware::PresentBackingStore(sk_sp backing_store) { - TRACE_EVENT0("flutter", "IOSSurfaceSoftware::PresentBackingStore"); + FML_TRACE_EVENT0("flutter", "IOSSurfaceSoftware::PresentBackingStore"); if (!IsValid() || backing_store == nullptr) { return false; } diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 81e17127bdc5e..c83b807abbcb5 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -950,7 +950,7 @@ FlutterEngineResult FlutterEngineOnVsync(FlutterEngine engine, return LOG_EMBEDDER_ERROR(kInvalidArguments); } - TRACE_EVENT0("flutter", "FlutterEngineOnVsync"); + FML_TRACE_EVENT0("flutter", "FlutterEngineOnVsync"); auto start_time = fml::TimePoint::FromEpochDelta( fml::TimeDelta::FromNanoseconds(frame_start_time_nanos)); diff --git a/shell/platform/embedder/embedder_engine.cc b/shell/platform/embedder/embedder_engine.cc index 79c8cf2f8b672..ee1a392ec0d20 100644 --- a/shell/platform/embedder/embedder_engine.cc +++ b/shell/platform/embedder/embedder_engine.cc @@ -94,8 +94,8 @@ bool EmbedderEngine::DispatchPointerDataPacket( return false; } - TRACE_EVENT0("flutter", "EmbedderEngine::DispatchPointerDataPacket"); - TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); + FML_TRACE_EVENT0("flutter", "EmbedderEngine::DispatchPointerDataPacket"); + FML_TRACE_FLOW_BEGIN("flutter", "PointerEvent", next_pointer_flow_id_); shell_->GetTaskRunners().GetUITaskRunner()->PostTask(fml::MakeCopyable( [engine = shell_->GetEngine(), packet = std::move(packet), diff --git a/shell/platform/embedder/embedder_surface_software.cc b/shell/platform/embedder/embedder_surface_software.cc index 0d24933cf5e3d..fec9beb34919e 100644 --- a/shell/platform/embedder/embedder_surface_software.cc +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -48,7 +48,7 @@ sk_sp EmbedderSurfaceSoftware::CreateResourceContext() const { // |GPUSurfaceSoftwareDelegate| sk_sp EmbedderSurfaceSoftware::AcquireBackingStore( const SkISize& size) { - TRACE_EVENT0("flutter", "EmbedderSurfaceSoftware::AcquireBackingStore"); + FML_TRACE_EVENT0("flutter", "EmbedderSurfaceSoftware::AcquireBackingStore"); if (!IsValid()) { FML_LOG(ERROR) << "Could not acquire backing store for the software surface."; diff --git a/shell/platform/fuchsia/dart/dart_runner.cc b/shell/platform/fuchsia/dart/dart_runner.cc index 670cb909238c4..c572c84b67cc0 100644 --- a/shell/platform/fuchsia/dart/dart_runner.cc +++ b/shell/platform/fuchsia/dart/dart_runner.cc @@ -189,7 +189,8 @@ void DartRunner::StartComponent( fuchsia::sys::Package package, fuchsia::sys::StartupInfo startup_info, ::fidl::InterfaceRequest controller) { - TRACE_EVENT1("dart", "StartComponent", "url", package.resolved_url.c_str()); + FML_TRACE_EVENT1("dart", "StartComponent", "url", + package.resolved_url.c_str()); std::thread thread(RunApplication, this, std::move(package), std::move(startup_info), context_->svc(), std::move(controller)); diff --git a/shell/platform/fuchsia/dart/main.cc b/shell/platform/fuchsia/dart/main.cc index 9c8327488721d..e5edf9a288478 100644 --- a/shell/platform/fuchsia/dart/main.cc +++ b/shell/platform/fuchsia/dart/main.cc @@ -40,7 +40,7 @@ int main(int argc, const char** argv) { fbl::unique_ptr provider; { - TRACE_EVENT0("dart", "CreateTraceProvider"); + FML_TRACE_EVENT0("dart", "CreateTraceProvider"); bool already_started; // Use CreateSynchronously to prevent loss of early events. trace::TraceProvider::CreateSynchronously(loop.dispatcher(), "dart_runner", diff --git a/shell/platform/fuchsia/flutter/compositor_context.cc b/shell/platform/fuchsia/flutter/compositor_context.cc index 6c56d262a2577..888d4d21630cb 100644 --- a/shell/platform/fuchsia/flutter/compositor_context.cc +++ b/shell/platform/fuchsia/flutter/compositor_context.cc @@ -34,21 +34,21 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame { { // Preroll the Flutter layer tree. This allows Flutter to perform // pre-paint optimizations. - TRACE_EVENT0("flutter", "Preroll"); + FML_TRACE_EVENT0("flutter", "Preroll"); layer_tree.Preroll(*this, true /* ignore raster cache */); } { // Traverse the Flutter layer tree so that the necessary session ops to // represent the frame are enqueued in the underlying session. - TRACE_EVENT0("flutter", "UpdateScene"); + FML_TRACE_EVENT0("flutter", "UpdateScene"); layer_tree.UpdateScene(session_connection_.scene_update_context(), session_connection_.root_node()); } { // Flush all pending session ops. - TRACE_EVENT0("flutter", "SessionPresent"); + FML_TRACE_EVENT0("flutter", "SessionPresent"); session_connection_.Present(*this); } diff --git a/shell/platform/fuchsia/flutter/engine.cc b/shell/platform/fuchsia/flutter/engine.cc index 7c85458193db7..65cb1a53a19d8 100644 --- a/shell/platform/fuchsia/flutter/engine.cc +++ b/shell/platform/fuchsia/flutter/engine.cc @@ -148,7 +148,7 @@ Engine::Engine(Delegate& delegate, // rasterizer. std::unique_ptr compositor_context; { - TRACE_EVENT0("flutter", "CreateCompositorContext"); + FML_TRACE_EVENT0("flutter", "CreateCompositorContext"); compositor_context = std::make_unique( thread_label_, // debug label std::move(view_token), // scenic view we attach our tree to @@ -210,7 +210,7 @@ Engine::Engine(Delegate& delegate, } { - TRACE_EVENT0("flutter", "CreateShell"); + FML_TRACE_EVENT0("flutter", "CreateShell"); shell_ = flutter::Shell::Create( task_runners, // host task runners settings_, // shell launch settings diff --git a/shell/platform/fuchsia/flutter/fuchsia_font_manager.cc b/shell/platform/fuchsia/flutter/fuchsia_font_manager.cc index 83264ad8a5ff3..004810a4e6779 100644 --- a/shell/platform/fuchsia/flutter/fuchsia_font_manager.cc +++ b/shell/platform/fuchsia/flutter/fuchsia_font_manager.cc @@ -419,7 +419,7 @@ sk_sp FuchsiaFontManager::FetchTypeface(const char family_name[], int bcp47_count, SkUnichar character, uint32_t flags) const { - TRACE_EVENT0("flutter", "FuchsiaFontManager::FetchTypeface"); + FML_TRACE_EVENT0("flutter", "FuchsiaFontManager::FetchTypeface"); fuchsia::fonts::Request request; request.family = family_name; request.weight = style.weight(); diff --git a/shell/platform/fuchsia/flutter/platform_view.cc b/shell/platform/fuchsia/flutter/platform_view.cc index 1157d1c744977..bda9bba92aa38 100644 --- a/shell/platform/fuchsia/flutter/platform_view.cc +++ b/shell/platform/fuchsia/flutter/platform_view.cc @@ -287,7 +287,7 @@ void PlatformView::OnScenicError(std::string error) { void PlatformView::OnScenicEvent( std::vector events) { - TRACE_EVENT0("flutter", "PlatformView::OnScenicEvent"); + FML_TRACE_EVENT0("flutter", "PlatformView::OnScenicEvent"); for (const auto& event : events) { switch (event.Which()) { case fuchsia::ui::scenic::Event::Tag::kGfx: @@ -426,13 +426,13 @@ static trace_flow_id_t PointerTraceHACK(float fa, float fb) { bool PlatformView::OnHandlePointerEvent( const fuchsia::ui::input::PointerEvent& pointer) { - TRACE_EVENT0("flutter", "PlatformView::OnHandlePointerEvent"); + FML_TRACE_EVENT0("flutter", "PlatformView::OnHandlePointerEvent"); #if !defined(FUCHSIA_SDK) // TODO(SCN-1278): Use proper trace_id for tracing flow. trace_flow_id_t trace_id = PointerTraceHACK(pointer.radius_major, pointer.radius_minor); - TRACE_FLOW_END("input", "dispatch_event_to_client", trace_id); + FML_TRACE_FLOW_END("input", "dispatch_event_to_client", trace_id); #endif // !defined(FUCHSIA_SDK) flutter::PointerData pointer_data; diff --git a/shell/platform/fuchsia/flutter/runner.cc b/shell/platform/fuchsia/flutter/runner.cc index c61f59bc3d34a..caf48338849f2 100644 --- a/shell/platform/fuchsia/flutter/runner.cc +++ b/shell/platform/fuchsia/flutter/runner.cc @@ -137,7 +137,7 @@ void Runner::StartComponent( fuchsia::sys::Package package, fuchsia::sys::StartupInfo startup_info, fidl::InterfaceRequest controller) { - TRACE_EVENT0("flutter", "StartComponent"); + FML_TRACE_EVENT0("flutter", "StartComponent"); // Notes on application termination: Application typically terminate on the // thread on which they were created. This usually means the thread was // specifically created to host the application. But we want to ensure that diff --git a/shell/platform/fuchsia/flutter/session_connection.cc b/shell/platform/fuchsia/flutter/session_connection.cc index 21e06564b1850..139fdc7edc325 100644 --- a/shell/platform/fuchsia/flutter/session_connection.cc +++ b/shell/platform/fuchsia/flutter/session_connection.cc @@ -81,8 +81,8 @@ void SessionConnection::EnqueueClearOps() { } void SessionConnection::PresentSession() { - TRACE_EVENT0("gfx", "SessionConnection::PresentSession"); - TRACE_FLOW_BEGIN("gfx", "Session::Present", next_present_trace_id_); + FML_TRACE_EVENT0("gfx", "SessionConnection::PresentSession"); + FML_TRACE_FLOW_BEGIN("gfx", "Session::Present", next_present_trace_id_); next_present_trace_id_++; ToggleSignal(vsync_event_handle_, false); diff --git a/shell/platform/fuchsia/flutter/vsync_waiter.cc b/shell/platform/fuchsia/flutter/vsync_waiter.cc index e8b52db443465..b3272cf0a4891 100644 --- a/shell/platform/fuchsia/flutter/vsync_waiter.cc +++ b/shell/platform/fuchsia/flutter/vsync_waiter.cc @@ -66,7 +66,7 @@ void VsyncWaiter::AwaitVSync() { } void VsyncWaiter::FireCallbackWhenSessionAvailable() { - TRACE_EVENT0("flutter", "VsyncWaiter::FireCallbackWhenSessionAvailable"); + FML_TRACE_EVENT0("flutter", "VsyncWaiter::FireCallbackWhenSessionAvailable"); FML_DCHECK(task_runners_.GetUITaskRunner()->RunsTasksOnCurrentThread()); if (session_wait_.Begin(async_get_default_dispatcher()) != ZX_OK) { FML_LOG(ERROR) << "Could not begin wait for Vsync."; diff --git a/shell/platform/fuchsia/flutter/vulkan_surface.cc b/shell/platform/fuchsia/flutter/vulkan_surface.cc index eb82eb987d01f..0acfc657ab35e 100644 --- a/shell/platform/fuchsia/flutter/vulkan_surface.cc +++ b/shell/platform/fuchsia/flutter/vulkan_surface.cc @@ -26,7 +26,7 @@ constexpr SkColorType kSkiaColorType = kBGRA_8888_SkColorType; bool CreateVulkanImage(vulkan::VulkanProvider& vulkan_provider, const SkISize& size, VulkanImage* out_vulkan_image) { - TRACE_EVENT0("flutter", "CreateVulkanImage"); + FML_TRACE_EVENT0("flutter", "CreateVulkanImage"); FML_DCHECK(!size.isEmpty()); FML_DCHECK(out_vulkan_image != nullptr); @@ -244,7 +244,7 @@ bool VulkanSurface::AllocateDeviceMemory(sk_sp context, }; { - TRACE_EVENT0("flutter", "vkAllocateMemory"); + FML_TRACE_EVENT0("flutter", "vkAllocateMemory"); VkDeviceMemory vk_memory = VK_NULL_HANDLE; if (VK_CALL_LOG_ERROR(vulkan_provider_.vk().AllocateMemory( vulkan_provider_.vk_device(), &alloc_info, NULL, &vk_memory)) != diff --git a/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc b/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc index c34b8fcc81ca1..157e6b851c3b0 100644 --- a/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc +++ b/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc @@ -108,7 +108,7 @@ std::unique_ptr VulkanSurfacePool::GetCachedOrCreateSurface( void VulkanSurfacePool::SubmitSurface( std::unique_ptr p_surface) { - TRACE_EVENT0("flutter", "VulkanSurfacePool::SubmitSurface"); + FML_TRACE_EVENT0("flutter", "VulkanSurfacePool::SubmitSurface"); // This cast is safe because |VulkanSurface| is the only implementation of // |SurfaceProducerSurface| for Flutter on Fuchsia. Additionally, it is @@ -157,7 +157,7 @@ void VulkanSurfacePool::SubmitSurface( std::unique_ptr VulkanSurfacePool::CreateSurface( const SkISize& size) { - TRACE_EVENT0("flutter", "VulkanSurfacePool::CreateSurface"); + FML_TRACE_EVENT0("flutter", "VulkanSurfacePool::CreateSurface"); auto surface = std::make_unique(vulkan_provider_, context_, scenic_session_, size); if (!surface->IsValid()) { @@ -217,7 +217,7 @@ void VulkanSurfacePool::SignalRetainedReady(flutter::LayerRasterCacheKey key) { } void VulkanSurfacePool::AgeAndCollectOldBuffers() { - TRACE_EVENT0("flutter", "VulkanSurfacePool::AgeAndCollectOldBuffers"); + FML_TRACE_EVENT0("flutter", "VulkanSurfacePool::AgeAndCollectOldBuffers"); // Remove all surfaces that are no longer valid or are too old. available_surfaces_.erase( diff --git a/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc b/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc index 0b678545bb4d4..11dae4f5f46a1 100644 --- a/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc +++ b/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc @@ -129,11 +129,11 @@ void VulkanSurfaceProducer::OnSurfacesPresented( std::vector< std::unique_ptr> surfaces) { - TRACE_EVENT0("flutter", "VulkanSurfaceProducer::OnSurfacesPresented"); + FML_TRACE_EVENT0("flutter", "VulkanSurfaceProducer::OnSurfacesPresented"); // Do a single flush for all canvases derived from the context. { - TRACE_EVENT0("flutter", "GrContext::flushAndSignalSemaphores"); + FML_TRACE_EVENT0("flutter", "GrContext::flushAndSignalSemaphores"); context_->flush(); } diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index 99be0100957d1..8eec9b4552b4e 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -185,7 +185,7 @@ FontCollection::GetMinikinFontCollectionForFamilies( std::shared_ptr FontCollection::FindFontFamilyInManagers( const std::string& family_name) { - TRACE_EVENT0("flutter", "FontCollection::FindFontFamilyInManagers"); + FML_TRACE_EVENT0("flutter", "FontCollection::FindFontFamilyInManagers"); // Search for the font family in each font manager. for (sk_sp& manager : GetFontManagerOrder()) { std::shared_ptr minikin_family = @@ -200,8 +200,8 @@ std::shared_ptr FontCollection::FindFontFamilyInManagers( std::shared_ptr FontCollection::CreateMinikinFontFamily( const sk_sp& manager, const std::string& family_name) { - TRACE_EVENT1("flutter", "FontCollection::CreateMinikinFontFamily", - "family_name", family_name.c_str()); + FML_TRACE_EVENT1("flutter", "FontCollection::CreateMinikinFontFamily", + "family_name", family_name.c_str()); sk_sp font_style_set( manager->matchFamily(family_name.c_str())); if (font_style_set == nullptr || font_style_set->count() == 0) { @@ -212,7 +212,7 @@ std::shared_ptr FontCollection::CreateMinikinFontFamily( // Add fonts to the Minikin font family. for (int i = 0; i < font_style_set->count(); ++i) { - TRACE_EVENT0("flutter", "CreateMinikinFont"); + FML_TRACE_EVENT0("flutter", "CreateMinikinFont"); // Create the skia typeface. sk_sp skia_typeface( sk_sp(font_style_set->createTypeface(i))); @@ -230,8 +230,8 @@ std::shared_ptr FontCollection::CreateMinikinFontFamily( minikin_fonts.emplace_back(std::move(minikin_font)); } - TRACE_EVENT1("flutter", "minikin::FontFamily", "MinikinFontsCount", - std::to_string(minikin_fonts.size()).c_str()); + FML_TRACE_EVENT1("flutter", "minikin::FontFamily", "MinikinFontsCount", + std::to_string(minikin_fonts.size()).c_str()); return std::make_shared(std::move(minikin_fonts)); } @@ -277,7 +277,7 @@ const std::shared_ptr& FontCollection::DoMatchFallbackFont( const std::shared_ptr& FontCollection::GetFallbackFontFamily(const sk_sp& manager, const std::string& family_name) { - TRACE_EVENT0("flutter", "FontCollection::GetFallbackFontFamily"); + FML_TRACE_EVENT0("flutter", "FontCollection::GetFallbackFontFamily"); auto fallback_it = fallback_fonts_.find(family_name); if (fallback_it != fallback_fonts_.end()) { return fallback_it->second;