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

Side by Side Diff: third_party/WebKit/Source/platform/TraceEvent.h

Issue 1916703002: Prepare for move-only PassOwnPtr in the remaining directories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@core1
Patch Set: Merge with trunk. Created 4 years, 8 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 template<typename T> struct TracedValueTraits { 435 template<typename T> struct TracedValueTraits {
436 static const bool isTracedValue = false; 436 static const bool isTracedValue = false;
437 static PassOwnPtr<TracedValue> moveFromIfTracedValue(const T&) 437 static PassOwnPtr<TracedValue> moveFromIfTracedValue(const T&)
438 { 438 {
439 return nullptr; 439 return nullptr;
440 } 440 }
441 }; 441 };
442 442
443 template<typename T> struct TracedValueTraits<PassOwnPtr<T>> { 443 template<typename T> struct TracedValueTraits<PassOwnPtr<T>> {
444 static const bool isTracedValue = std::is_convertible<T*, TracedValue*>::val ue; 444 static const bool isTracedValue = std::is_convertible<T*, TracedValue*>::val ue;
445 static PassOwnPtr<TracedValue> moveFromIfTracedValue(const PassOwnPtr<T>& tr acedValue) 445 static PassOwnPtr<TracedValue> moveFromIfTracedValue(PassOwnPtr<T>&& tracedV alue)
446 { 446 {
447 return tracedValue; 447 return std::move(tracedValue);
448 } 448 }
449 }; 449 };
450 450
451 template<typename T> bool isTracedValue(const T&) 451 template<typename T> bool isTracedValue(const T&)
452 { 452 {
453 return TracedValueTraits<T>::isTracedValue; 453 return TracedValueTraits<T>::isTracedValue;
454 } 454 }
455 455
456 template<typename T> PassOwnPtr<TracedValue> moveFromIfTracedValue(const T& valu e) 456 template<typename T> PassOwnPtr<TracedValue> moveFromIfTracedValue(T&& value)
457 { 457 {
458 return TracedValueTraits<T>::moveFromIfTracedValue(value); 458 return TracedValueTraits<T>::moveFromIfTracedValue(std::forward<T>(value));
459 } 459 }
460 460
461 // These addTraceEvent template functions are defined here instead of in the 461 // These addTraceEvent template functions are defined here instead of in the
462 // macro, because the arg values could be temporary string objects. In order to 462 // macro, because the arg values could be temporary string objects. In order to
463 // store pointers to the internal c_str and pass through to the tracing API, the 463 // store pointers to the internal c_str and pass through to the tracing API, the
464 // arg values must live throughout these procedures. 464 // arg values must live throughout these procedures.
465 465
466 static inline TraceEventHandle addTraceEvent( 466 static inline TraceEventHandle addTraceEvent(
467 char phase, 467 char phase,
468 const unsigned char* categoryEnabled, 468 const unsigned char* categoryEnabled,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 const char* m_categoryGroup; 681 const char* m_categoryGroup;
682 const char* m_name; 682 const char* m_name;
683 IDType m_id; 683 IDType m_id;
684 }; 684 };
685 685
686 } // namespace TraceEvent 686 } // namespace TraceEvent
687 687
688 } // namespace blink 688 } // namespace blink
689 689
690 #endif 690 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698