Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef TraceLocation_h | 5 #ifndef TraceLocation_h |
| 6 #define TraceLocation_h | 6 #define TraceLocation_h |
| 7 | 7 |
| 8 #include "public/platform/WebTraceLocation.h" | |
| 9 | |
| 8 // This is intentionally similar to base/location.h | 10 // This is intentionally similar to base/location.h |
| 9 // that we could easily replace usage of TraceLocation | 11 // that we could easily replace usage of TraceLocation |
| 10 // with base::Location after merging into Chromium. | 12 // with base::Location after merging into Chromium. |
| 11 | 13 |
| 12 namespace blink { | 14 namespace blink { |
| 13 | 15 |
| 14 class TraceLocation { | 16 class TraceLocation { |
| 15 public: | 17 public: |
| 16 // Currenetly only store the bits used in Blink, base::Location stores more. | 18 // Currenetly only store the bits used in Blink, base::Location stores more. |
|
Mike West
2014/10/24 14:59:35
Nit: s/Currenetly/Currently/g
Sami
2014/10/24 15:24:39
Done.
| |
| 17 // These char*s are not copied and must live for the duration of the program . | 19 // These char*s are not copied and must live for the duration of the program . |
| 18 TraceLocation(const char* functionName, const char* fileName) | 20 TraceLocation(const char* functionName, const char* fileName) |
| 19 : m_functionName(functionName) | 21 : m_functionName(functionName) |
| 20 , m_fileName(fileName) | 22 , m_fileName(fileName) |
| 21 { } | 23 { } |
| 22 | 24 |
| 23 TraceLocation() | 25 TraceLocation() |
| 24 : m_functionName("unknown") | 26 : m_functionName("unknown") |
| 25 , m_fileName("unknown") | 27 , m_fileName("unknown") |
| 26 { } | 28 { } |
| 27 | 29 |
| 28 const char* functionName() const { return m_functionName; } | 30 const char* functionName() const { return m_functionName; } |
| 29 const char* fileName() const { return m_fileName; } | 31 const char* fileName() const { return m_fileName; } |
| 30 | 32 |
| 33 WebTraceLocation toWebTraceLocation() const | |
| 34 { | |
| 35 return WebTraceLocation(m_functionName, m_fileName); | |
| 36 } | |
| 37 | |
| 31 private: | 38 private: |
| 32 const char* m_functionName; | 39 const char* m_functionName; |
| 33 const char* m_fileName; | 40 const char* m_fileName; |
| 34 }; | 41 }; |
| 35 | 42 |
| 36 #define FROM_HERE ::blink::TraceLocation(__FUNCTION__, __FILE__) | 43 #define FROM_HERE ::blink::TraceLocation(__FUNCTION__, __FILE__) |
| 37 } // namespace blink | 44 } // namespace blink |
| 38 | 45 |
| 39 #endif // TraceLocation_h | 46 #endif // TraceLocation_h |
| OLD | NEW |