mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove unused trace sampling states
R=ojan@chromium.org Review URL: https://codereview.chromium.org/893503002
This commit is contained in:
parent
fa57fe2819
commit
65a50f6c81
@ -69,7 +69,6 @@ void CoreInitializer::init()
|
||||
|
||||
QualifiedName::init();
|
||||
Partitions::init();
|
||||
EventTracer::initialize();
|
||||
|
||||
// Ensure that the main thread's thread-local data is initialized before
|
||||
// starting any worker threads.
|
||||
|
||||
@ -40,29 +40,6 @@ namespace blink {
|
||||
|
||||
COMPILE_ASSERT(sizeof(blink::Platform::TraceEventHandle) == sizeof(TraceEvent::TraceEventHandle), TraceEventHandle_types_must_be_compatible);
|
||||
|
||||
// The dummy variable is needed to avoid a crash when someone updates the state variables
|
||||
// before EventTracer::initialize() is called.
|
||||
long dummyTraceSamplingState = 0;
|
||||
long* traceSamplingState[3] = {&dummyTraceSamplingState, &dummyTraceSamplingState, &dummyTraceSamplingState };
|
||||
|
||||
void EventTracer::initialize()
|
||||
{
|
||||
// current() might not exist in unit tests.
|
||||
if (!blink::Platform::current())
|
||||
return;
|
||||
|
||||
traceSamplingState[0] = blink::Platform::current()->getTraceSamplingState(0);
|
||||
// FIXME: traceSamplingState[0] can be 0 in split-dll build. http://crbug.com/256965
|
||||
if (!traceSamplingState[0])
|
||||
traceSamplingState[0] = &dummyTraceSamplingState;
|
||||
traceSamplingState[1] = blink::Platform::current()->getTraceSamplingState(1);
|
||||
if (!traceSamplingState[1])
|
||||
traceSamplingState[1] = &dummyTraceSamplingState;
|
||||
traceSamplingState[2] = blink::Platform::current()->getTraceSamplingState(2);
|
||||
if (!traceSamplingState[2])
|
||||
traceSamplingState[2] = &dummyTraceSamplingState;
|
||||
}
|
||||
|
||||
const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* categoryName)
|
||||
{
|
||||
static const char* dummyCategoryEnabledFlag = "*";
|
||||
|
||||
@ -50,12 +50,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
// FIXME: Make these global variables thread-safe. Make a value update atomic.
|
||||
PLATFORM_EXPORT extern long* traceSamplingState[3];
|
||||
|
||||
class PLATFORM_EXPORT EventTracer {
|
||||
public:
|
||||
static void initialize();
|
||||
static const unsigned char* getTraceCategoryEnabledFlag(const char*);
|
||||
static TraceEvent::TraceEventHandle addTraceEvent(char phase,
|
||||
const unsigned char* categoryEnabledFlag,
|
||||
|
||||
@ -54,7 +54,6 @@ int main(int argc, char** argv)
|
||||
blink::TestingPlatformSupport platform(platformConfig);
|
||||
|
||||
blink::Partitions::init();
|
||||
blink::EventTracer::initialize();
|
||||
int result = base::RunUnitTestsUsingBaseTestSuite(argc, argv);
|
||||
blink::Partitions::shutdown();
|
||||
return result;
|
||||
|
||||
@ -234,14 +234,6 @@ public:
|
||||
// addTraceEvent is expected to be called by the trace event macros.
|
||||
virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) { return 0; }
|
||||
|
||||
typedef long int TraceEventAPIAtomicWord;
|
||||
|
||||
// Get a pointer to a global state of the given thread. An embedder is
|
||||
// expected to update the global state as the state of the embedder changes.
|
||||
// A sampling thread in the Chromium side reads the global state periodically
|
||||
// and reflects the sampling profiled results into about:tracing.
|
||||
virtual TraceEventAPIAtomicWord* getTraceSamplingState(const unsigned bucketName) { return 0; }
|
||||
|
||||
typedef uint64_t TraceEventHandle;
|
||||
|
||||
// Add a trace event to the platform tracing system. Depending on the actual
|
||||
|
||||
@ -128,20 +128,6 @@ const unsigned char* PlatformImpl::getTraceCategoryEnabledFlag(
|
||||
return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
|
||||
}
|
||||
|
||||
long* PlatformImpl::getTraceSamplingState(const unsigned thread_bucket) {
|
||||
switch (thread_bucket) {
|
||||
case 0:
|
||||
return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(0));
|
||||
case 1:
|
||||
return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(1));
|
||||
case 2:
|
||||
return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(2));
|
||||
default:
|
||||
NOTREACHED() << "Unknown thread bucket type.";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
COMPILE_ASSERT(
|
||||
sizeof(blink::Platform::TraceEventHandle) ==
|
||||
sizeof(base::debug::TraceEventHandle),
|
||||
|
||||
@ -34,7 +34,6 @@ class PlatformImpl : public blink::Platform {
|
||||
virtual blink::WebURLError cancelledError(const blink::WebURL& url) const;
|
||||
virtual const unsigned char* getTraceCategoryEnabledFlag(
|
||||
const char* category_name);
|
||||
virtual long* getTraceSamplingState(const unsigned thread_bucket);
|
||||
virtual TraceEventHandle addTraceEvent(
|
||||
char phase,
|
||||
const unsigned char* category_group_enabled,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user