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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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>
40 #include <stdio.h> 41 #include <stdio.h>
41 42
42 namespace blink { 43 namespace blink {
43 44
44 static_assert(sizeof(TraceEvent::TraceEventHandle) == sizeof(base::trace_event:: TraceEventHandle), "TraceEventHandle types must be the same"); 45 static_assert(sizeof(TraceEvent::TraceEventHandle) == sizeof(base::trace_event:: TraceEventHandle), "TraceEventHandle types must be the same");
45 static_assert(sizeof(TraceEvent::TraceEventAPIAtomicWord) == sizeof(const char*) , "TraceEventAPIAtomicWord must be pointer-sized."); 46 static_assert(sizeof(TraceEvent::TraceEventAPIAtomicWord) == sizeof(const char*) , "TraceEventAPIAtomicWord must be pointer-sized.");
46 47
47 // The dummy variable is needed to avoid a crash when someone updates the state variables 48 // The dummy variable is needed to avoid a crash when someone updates the state variables
48 // before EventTracer::initialize() is called. 49 // before EventTracer::initialize() is called.
49 TraceEvent::TraceEventAPIAtomicWord dummyTraceSamplingState = 0; 50 TraceEvent::TraceEventAPIAtomicWord dummyTraceSamplingState = 0;
(...skipping 15 matching lines...) Expand all
65 66
66 const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* catego ryName) 67 const unsigned char* EventTracer::getTraceCategoryEnabledFlag(const char* catego ryName)
67 { 68 {
68 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(categoryName); 69 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(categoryName);
69 } 70 }
70 71
71 TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign ed char* categoryEnabledFlag, 72 TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign ed char* categoryEnabledFlag,
72 const char* name, const char* scope, unsigned long long id, unsigned long lo ng bindId, double timestamp, 73 const char* name, const char* scope, unsigned long long id, unsigned long lo ng bindId, double timestamp,
73 int numArgs, const char* argNames[], const unsigned char argTypes[], 74 int numArgs, const char* argNames[], const unsigned char argTypes[],
74 const unsigned long long argValues[], 75 const unsigned long long argValues[],
75 PassOwnPtr<TracedValue> tracedValue1, 76 std::unique_ptr<TracedValue> tracedValue1,
76 PassOwnPtr<TracedValue> tracedValue2, 77 std::unique_ptr<TracedValue> tracedValue2,
77 unsigned flags) 78 unsigned flags)
78 { 79 {
79 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2] ; 80 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> convertables[2] ;
80 ASSERT(numArgs <= 2); 81 ASSERT(numArgs <= 2);
81 // We move m_tracedValues from TracedValues for thread safety. 82 // We move m_tracedValues from TracedValues for thread safety.
82 // https://crbug.com/478149 83 // https://crbug.com/478149
83 if (numArgs >= 1 && argTypes[0] == TRACE_VALUE_TYPE_CONVERTABLE) 84 if (numArgs >= 1 && argTypes[0] == TRACE_VALUE_TYPE_CONVERTABLE)
84 convertables[0] = std::move(tracedValue1->m_tracedValue); 85 convertables[0] = std::move(tracedValue1->m_tracedValue);
85 if (numArgs >= 2 && argTypes[1] == TRACE_VALUE_TYPE_CONVERTABLE) 86 if (numArgs >= 2 && argTypes[1] == TRACE_VALUE_TYPE_CONVERTABLE)
86 convertables[1] = std::move(tracedValue2->m_tracedValue); 87 convertables[1] = std::move(tracedValue2->m_tracedValue);
(...skipping 26 matching lines...) Expand all
113 memcpy(&traceEventHandle, &handle, sizeof(handle)); 114 memcpy(&traceEventHandle, &handle, sizeof(handle));
114 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(categoryEnabledFlag, name, trace EventHandle); 115 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(categoryEnabledFlag, name, trace EventHandle);
115 } 116 }
116 117
117 double EventTracer::systemTraceTime() 118 double EventTracer::systemTraceTime()
118 { 119 {
119 return (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); 120 return (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
120 } 121 }
121 122
122 } // namespace blink 123 } // 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