Skip to content

Commit

Permalink
Fix PipelineProducer traces. Also add back the OnDisplayLink trace on…
Browse files Browse the repository at this point in the history
… iOS. (flutter#3201)
  • Loading branch information
chinmaygarde authored Nov 4, 2016
1 parent 3164a97 commit c44d049
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions shell/platform/darwin/ios/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ shared_library("flutter_framework_dylib") {
deps = [
"//base:base",
"//dart/runtime:libdart",
"//flutter/glue",
"//flutter/lib/ui",
"//flutter/shell/common",
"//flutter/shell/gpu",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <mach/mach_time.h>

#include "flutter/common/threads.h"
#include "flutter/glue/trace_event.h"
#include "lib/ftl/logging.h"

@interface VSyncClient : NSObject
Expand All @@ -20,6 +21,7 @@ @interface VSyncClient : NSObject
@implementation VSyncClient {
CADisplayLink* _displayLink;
shell::VsyncWaiter::Callback _pendingCallback;
bool _traceCounter;
}

- (instancetype)init {
Expand All @@ -44,6 +46,8 @@ - (void)await:(shell::VsyncWaiter::Callback)callback {
}

- (void)onDisplayLink:(CADisplayLink*)link {
_traceCounter = !_traceCounter;
TRACE_COUNTER1("flutter", "OnDisplayLink", _traceCounter);
ftl::TimePoint frame_time = ftl::TimePoint::Now();
_displayLink.paused = YES;
auto callback = std::move(_pendingCallback);
Expand Down
11 changes: 4 additions & 7 deletions synchronization/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#ifndef SYNCHRONIZATION_PIPELINE_H_
#define SYNCHRONIZATION_PIPELINE_H_

#include "flutter/glue/trace_event.h"
#include "flutter/synchronization/pipeline.h"
#include "flutter/synchronization/semaphore.h"
#include "lib/ftl/functional/closure.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/ref_counted.h"
#include "lib/ftl/synchronization/mutex.h"
#include "lib/ftl/functional/closure.h"
#include "flutter/synchronization/semaphore.h"
#include "flutter/synchronization/pipeline.h"
#include "flutter/glue/trace_event.h"

#include <memory>
#include <queue>
Expand Down Expand Up @@ -74,7 +74,6 @@ class Pipeline : public ftl::RefCountedThreadSafe<Pipeline<R>> {

ProducerContinuation(Continuation continuation, size_t trace_id)
: continuation_(continuation), trace_id_(trace_id) {
TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineItem", trace_id_);
TRACE_EVENT_ASYNC_BEGIN0("flutter", "PipelineProduce", trace_id_);
}

Expand Down Expand Up @@ -129,8 +128,6 @@ class Pipeline : public ftl::RefCountedThreadSafe<Pipeline<R>> {

empty_.Signal();

TRACE_EVENT_ASYNC_END0("flutter", "PipelineItem", trace_id);

return items_count > 0 ? PipelineConsumeResult::MoreAvailable
: PipelineConsumeResult::Done;
}
Expand Down

0 comments on commit c44d049

Please sign in to comment.