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

Side by Side Diff: base/debug/trace_event_impl.cc

Issue 79373002: Remove temporary code after migration of Platform::updateTraceEventDuration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/child/webkitplatformsupport_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/trace_event_impl.h" 5 #include "base/debug/trace_event_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 TraceEventETWProvider::Trace(name, phase, id, extra); 1926 TraceEventETWProvider::Trace(name, phase, id, extra);
1927 #endif 1927 #endif
1928 INTERNAL_TRACE_EVENT_ADD(phase, "ETW Trace Event", name, 1928 INTERNAL_TRACE_EVENT_ADD(phase, "ETW Trace Event", name,
1929 TRACE_EVENT_FLAG_COPY, "id", id, "extra", extra); 1929 TRACE_EVENT_FLAG_COPY, "id", id, "extra", extra);
1930 } 1930 }
1931 1931
1932 void TraceLog::UpdateTraceEventDuration( 1932 void TraceLog::UpdateTraceEventDuration(
1933 const unsigned char* category_group_enabled, 1933 const unsigned char* category_group_enabled,
1934 const char* name, 1934 const char* name,
1935 TraceEventHandle handle) { 1935 TraceEventHandle handle) {
1936 OptionalAutoLock lock(lock_); 1936 TimeTicks now = OffsetNow();
1937 1937
1938 TimeTicks now = OffsetNow(); 1938 if (*category_group_enabled & ENABLED_FOR_RECORDING) {
1939 TraceEvent* trace_event = NULL; 1939 OptionalAutoLock lock(lock_);
1940 // TODO(wangxianzhu): Remove the !category_group_enabled condition after 1940
1941 // all clients migrate to the new UpdateTraceEventDuration API. 1941 TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock);
1942 if (!category_group_enabled ||
1943 (*category_group_enabled & ENABLED_FOR_RECORDING)) {
1944 trace_event = GetEventByHandleInternal(handle, &lock);
1945 if (trace_event) { 1942 if (trace_event) {
1946 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); 1943 DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE);
1947 trace_event->UpdateDuration(now); 1944 trace_event->UpdateDuration(now);
1948 #if defined(OS_ANDROID) 1945 #if defined(OS_ANDROID)
1949 trace_event->SendToATrace(); 1946 trace_event->SendToATrace();
1950 #endif 1947 #endif
1951 } 1948 }
1952 1949
1953 if (trace_options() & ECHO_TO_CONSOLE) { 1950 if (trace_options() & ECHO_TO_CONSOLE) {
1954 lock.EnsureAcquired(); 1951 lock.EnsureAcquired();
1955 OutputEventToConsoleWhileLocked(TRACE_EVENT_PHASE_END, now, trace_event); 1952 OutputEventToConsoleWhileLocked(TRACE_EVENT_PHASE_END, now, trace_event);
1956 } 1953 }
1957 } 1954 }
1958 1955
1959 // TODO(wangxianzhu): Remove this block after all clients migrate to the
1960 // new UpdateTraceEventDuration API.
1961 if (!category_group_enabled || !name) {
1962 if (!trace_event)
1963 return;
1964 category_group_enabled = trace_event->category_group_enabled();
1965 name = trace_event->name();
1966 }
1967
1968 lock.EnsureReleased();
1969 if (*category_group_enabled & ENABLED_FOR_EVENT_CALLBACK) { 1956 if (*category_group_enabled & ENABLED_FOR_EVENT_CALLBACK) {
1970 EventCallback event_callback = reinterpret_cast<EventCallback>( 1957 EventCallback event_callback = reinterpret_cast<EventCallback>(
1971 subtle::NoBarrier_Load(&event_callback_)); 1958 subtle::NoBarrier_Load(&event_callback_));
1972 event_callback(now, TRACE_EVENT_PHASE_END, category_group_enabled, name, 1959 event_callback(now, TRACE_EVENT_PHASE_END, category_group_enabled, name,
1973 trace_event_internal::kNoEventId, 0, NULL, NULL, NULL, 1960 trace_event_internal::kNoEventId, 0, NULL, NULL, NULL,
1974 TRACE_EVENT_FLAG_NONE); 1961 TRACE_EVENT_FLAG_NONE);
1975 } 1962 }
1976 } 1963 }
1977 1964
1978 void TraceLog::SetWatchEvent(const std::string& category_name, 1965 void TraceLog::SetWatchEvent(const std::string& category_name,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 } 2315 }
2329 2316
2330 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 2317 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
2331 if (*category_group_enabled_) { 2318 if (*category_group_enabled_) {
2332 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, 2319 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_,
2333 name_, event_handle_); 2320 name_, event_handle_);
2334 } 2321 }
2335 } 2322 }
2336 2323
2337 } // namespace trace_event_internal 2324 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « no previous file | webkit/child/webkitplatformsupport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698