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 // This is intentionally similar to base/location.h | 8 // This is intentionally similar to base/location.h |
9 // that we could easily replace usage of TraceLocation | 9 // that we could easily replace usage of TraceLocation |
10 // with base::Location after merging into Chromium. | 10 // with base::Location after merging into Chromium. |
11 | 11 |
12 namespace WebCore { | 12 namespace blink { |
13 | 13 |
14 class TraceLocation { | 14 class TraceLocation { |
15 public: | 15 public: |
16 // Currenetly only store the bits used in Blink, base::Location stores more. | 16 // Currenetly only store the bits used in Blink, base::Location stores more. |
17 // These char*s are not copied and must live for the duration of the program
. | 17 // These char*s are not copied and must live for the duration of the program
. |
18 TraceLocation(const char* functionName, const char* fileName) | 18 TraceLocation(const char* functionName, const char* fileName) |
19 : m_functionName(functionName) | 19 : m_functionName(functionName) |
20 , m_fileName(fileName) | 20 , m_fileName(fileName) |
21 { } | 21 { } |
22 | 22 |
23 TraceLocation() | 23 TraceLocation() |
24 : m_functionName("unknown") | 24 : m_functionName("unknown") |
25 , m_fileName("unknown") | 25 , m_fileName("unknown") |
26 { } | 26 { } |
27 | 27 |
28 const char* functionName() const { return m_functionName; } | 28 const char* functionName() const { return m_functionName; } |
29 const char* fileName() const { return m_fileName; } | 29 const char* fileName() const { return m_fileName; } |
30 | 30 |
31 private: | 31 private: |
32 const char* m_functionName; | 32 const char* m_functionName; |
33 const char* m_fileName; | 33 const char* m_fileName; |
34 }; | 34 }; |
35 | 35 |
36 #define FROM_HERE ::WebCore::TraceLocation(__FUNCTION__, __FILE__) | 36 #define FROM_HERE ::blink::TraceLocation(__FUNCTION__, __FILE__) |
37 } | 37 } |
38 | 38 |
39 #endif // TraceLocation_h | 39 #endif // TraceLocation_h |
OLD | NEW |