OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "platform/EventTracer.h" | 32 #include "platform/EventTracer.h" |
33 | 33 |
34 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
35 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
36 #include <stdio.h> | 36 #include <stdio.h> |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 COMPILE_ASSERT(sizeof(WebKit::Platform::TraceEventHandle) == sizeof(TraceEvent::
TraceEventHandle), TraceEventHandle_types_must_be_compatible); | 40 COMPILE_ASSERT(sizeof(blink::Platform::TraceEventHandle) == sizeof(TraceEvent::T
raceEventHandle), TraceEventHandle_types_must_be_compatible); |
41 | 41 |
42 // The dummy variable is needed to avoid a crash when someone updates the state
variables | 42 // The dummy variable is needed to avoid a crash when someone updates the state
variables |
43 // before EventTracer::initialize() is called. | 43 // before EventTracer::initialize() is called. |
44 long dummyTraceSamplingState = 0; | 44 long dummyTraceSamplingState = 0; |
45 long* traceSamplingState[3] = {&dummyTraceSamplingState, &dummyTraceSamplingStat
e, &dummyTraceSamplingState }; | 45 long* traceSamplingState[3] = {&dummyTraceSamplingState, &dummyTraceSamplingStat
e, &dummyTraceSamplingState }; |
46 | 46 |
47 void EventTracer::initialize() | 47 void EventTracer::initialize() |
48 { | 48 { |
49 traceSamplingState[0] = WebKit::Platform::current()->getTraceSamplingState(0
); | 49 traceSamplingState[0] = blink::Platform::current()->getTraceSamplingState(0)
; |
50 // FIXME: traceSamplingState[0] can be 0 in split-dll build. http://crbug.co
m/256965 | 50 // FIXME: traceSamplingState[0] can be 0 in split-dll build. http://crbug.co
m/256965 |
51 if (!traceSamplingState[0]) | 51 if (!traceSamplingState[0]) |
52 traceSamplingState[0] = &dummyTraceSamplingState; | 52 traceSamplingState[0] = &dummyTraceSamplingState; |
53 traceSamplingState[1] = WebKit::Platform::current()->getTraceSamplingState(1
); | 53 traceSamplingState[1] = blink::Platform::current()->getTraceSamplingState(1)
; |
54 if (!traceSamplingState[1]) | 54 if (!traceSamplingState[1]) |
55 traceSamplingState[1] = &dummyTraceSamplingState; | 55 traceSamplingState[1] = &dummyTraceSamplingState; |
56 traceSamplingState[2] = WebKit::Platform::current()->getTraceSamplingState(2
); | 56 traceSamplingState[2] = blink::Platform::current()->getTraceSamplingState(2)
; |
57 if (!traceSamplingState[2]) | 57 if (!traceSamplingState[2]) |
58 traceSamplingState[2] = &dummyTraceSamplingState; | 58 traceSamplingState[2] = &dummyTraceSamplingState; |
59 } | 59 } |
60 | 60 |
61 const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* catego
ryName) | 61 const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* catego
ryName) |
62 { | 62 { |
63 return WebKit::Platform::current()->getTraceCategoryEnabledFlag(categoryName
); | 63 return blink::Platform::current()->getTraceCategoryEnabledFlag(categoryName)
; |
64 } | 64 } |
65 | 65 |
66 TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign
ed char* categoryEnabledFlag, | 66 TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign
ed char* categoryEnabledFlag, |
67 const char* name, unsigned long long id, int numArgs, const char** argNames, | 67 const char* name, unsigned long long id, int numArgs, const char** argNames, |
68 const unsigned char* argTypes, const unsigned long long* argValues, unsigned
char flags) | 68 const unsigned char* argTypes, const unsigned long long* argValues, unsigned
char flags) |
69 { | 69 { |
70 return WebKit::Platform::current()->addTraceEvent(phase, categoryEnabledFlag
, name, id, numArgs, argNames, argTypes, argValues, flags); | 70 return blink::Platform::current()->addTraceEvent(phase, categoryEnabledFlag,
name, id, numArgs, argNames, argTypes, argValues, flags); |
71 } | 71 } |
72 | 72 |
73 void EventTracer::updateTraceEventDuration(TraceEvent::TraceEventHandle handle) | 73 void EventTracer::updateTraceEventDuration(TraceEvent::TraceEventHandle handle) |
74 { | 74 { |
75 WebKit::Platform::current()->updateTraceEventDuration(handle); | 75 blink::Platform::current()->updateTraceEventDuration(handle); |
76 } | 76 } |
77 | 77 |
78 } // namespace WebCore | 78 } // namespace WebCore |
OLD | NEW |