Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: third_party/WebKit/Source/platform/EventTracer.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
30 30
31 #include "platform/EventTracer.h" 31 #include "platform/EventTracer.h"
32 32
33 #include "base/time/time.h" 33 #include "base/time/time.h"
34 #include "base/trace_event/trace_event.h" 34 #include "base/trace_event/trace_event.h"
35 #include "base/trace_event/trace_event_argument.h" 35 #include "base/trace_event/trace_event_argument.h"
36 #include "platform/TracedValue.h" 36 #include "platform/TracedValue.h"
37 #include "public/platform/Platform.h" 37 #include "public/platform/Platform.h"
38 #include "wtf/Assertions.h" 38 #include "wtf/Assertions.h"
39 #include "wtf/text/StringUTF8Adaptor.h" 39 #include "wtf/text/StringUTF8Adaptor.h"
40 #include <memory>
41 #include <stdio.h> 40 #include <stdio.h>
42 41
43 namespace blink { 42 namespace blink {
44 43
45 static_assert(sizeof(TraceEvent::TraceEventHandle) == sizeof(base::trace_event:: TraceEventHandle), "TraceEventHandle types must be the same"); 44 static_assert(sizeof(TraceEvent::TraceEventHandle) == sizeof(base::trace_event:: TraceEventHandle), "TraceEventHandle types must be the same");
46 static_assert(sizeof(TraceEvent::TraceEventAPIAtomicWord) == sizeof(const char*) , "TraceEventAPIAtomicWord must be pointer-sized."); 45 static_assert(sizeof(TraceEvent::TraceEventAPIAtomicWord) == sizeof(const char*) , "TraceEventAPIAtomicWord must be pointer-sized.");
47 46
48 // The dummy variable is needed to avoid a crash when someone updates the state variables 47 // The dummy variable is needed to avoid a crash when someone updates the state variables
49 // before EventTracer::initialize() is called. 48 // before EventTracer::initialize() is called.
50 TraceEvent::TraceEventAPIAtomicWord dummyTraceSamplingState = 0; 49 TraceEvent::TraceEventAPIAtomicWord dummyTraceSamplingState = 0;
(...skipping 15 matching lines...) Expand all
66 65
67 const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* catego ryName) 66 const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* catego ryName)
68 { 67 {
69 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(categoryName); 68 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(categoryName);
70 } 69 }
71 70
72 TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign ed char* categoryEnabledFlag, 71 TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign ed char* categoryEnabledFlag,
73 const char* name, const char* scope, unsigned long long id, unsigned long lo ng bindId, double timestamp, 72 const char* name, const char* scope, unsigned long long id, unsigned long lo ng bindId, double timestamp,
74 int numArgs, const char* argNames[], const unsigned char argTypes[], 73 int numArgs, const char* argNames[], const unsigned char argTypes[],
75 const unsigned long long argValues[], 74 const unsigned long long argValues[],
76 std::unique_ptr<TracedValue> tracedValue1, 75 PassOwnPtr<TracedValue> tracedValue1,
77 std::unique_ptr<TracedValue> tracedValue2, 76 PassOwnPtr<TracedValue> tracedValue2,
78 unsigned flags) 77 unsigned flags)
79 { 78 {
80 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2] ; 79 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2] ;
81 ASSERT(numArgs <= 2); 80 ASSERT(numArgs <= 2);
82 // We move m_tracedValues from TracedValues for thread safety. 81 // We move m_tracedValues from TracedValues for thread safety.
83 // https://crbug.com/478149 82 // https://crbug.com/478149
84 if (numArgs >= 1 && argTypes[0] == TRACE_VALUE_TYPE_CONVERTABLE) 83 if (numArgs >= 1 && argTypes[0] == TRACE_VALUE_TYPE_CONVERTABLE)
85 convertables[0] = std::move(tracedValue1->m_tracedValue); 84 convertables[0] = std::move(tracedValue1->m_tracedValue);
86 if (numArgs >= 2 && argTypes[1] == TRACE_VALUE_TYPE_CONVERTABLE) 85 if (numArgs >= 2 && argTypes[1] == TRACE_VALUE_TYPE_CONVERTABLE)
87 convertables[1] = std::move(tracedValue2->m_tracedValue); 86 convertables[1] = std::move(tracedValue2->m_tracedValue);
(...skipping 26 matching lines...) Expand all
114 memcpy(&traceEventHandle, &handle, sizeof(handle)); 113 memcpy(&traceEventHandle, &handle, sizeof(handle));
115 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(categoryEnabledFlag, name, trace EventHandle); 114 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(categoryEnabledFlag, name, trace EventHandle);
116 } 115 }
117 116
118 double EventTracer::systemTraceTime() 117 double EventTracer::systemTraceTime()
119 { 118 {
120 return (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); 119 return (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
121 } 120 }
122 121
123 } // namespace blink 122 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/EventTracer.h ('k') | third_party/WebKit/Source/platform/PODArena.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698