OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef V8DOMActivityLogger_h | 31 #ifndef V8DOMActivityLogger_h |
32 #define V8DOMActivityLogger_h | 32 #define V8DOMActivityLogger_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "wtf/PassOwnPtr.h" |
35 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
36 #include <memory> | |
37 #include <v8.h> | 37 #include <v8.h> |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class KURL; | 41 class KURL; |
42 | 42 |
43 class CORE_EXPORT V8DOMActivityLogger { | 43 class CORE_EXPORT V8DOMActivityLogger { |
44 USING_FAST_MALLOC(V8DOMActivityLogger); | 44 USING_FAST_MALLOC(V8DOMActivityLogger); |
45 public: | 45 public: |
46 virtual ~V8DOMActivityLogger() { } | 46 virtual ~V8DOMActivityLogger() { } |
47 | 47 |
48 virtual void logGetter(const String& apiName) { } | 48 virtual void logGetter(const String& apiName) { } |
49 virtual void logSetter(const String& apiName, const v8::Local<v8::Value>& ne
wValue) { } | 49 virtual void logSetter(const String& apiName, const v8::Local<v8::Value>& ne
wValue) { } |
50 virtual void logMethod(const String& apiName, int argc, const v8::Local<v8::
Value>* argv) { } | 50 virtual void logMethod(const String& apiName, int argc, const v8::Local<v8::
Value>* argv) { } |
51 virtual void logEvent(const String& eventName, int argc, const String* argv)
{ } | 51 virtual void logEvent(const String& eventName, int argc, const String* argv)
{ } |
52 | 52 |
53 // Associates a logger with the world identified by worldId (worlId may be 0 | 53 // Associates a logger with the world identified by worldId (worlId may be 0 |
54 // identifying the main world) and extension ID. Extension ID is used to | 54 // identifying the main world) and extension ID. Extension ID is used to |
55 // identify a logger for main world only (worldId == 0). If the world is not | 55 // identify a logger for main world only (worldId == 0). If the world is not |
56 // a main world, an extension ID is ignored. | 56 // a main world, an extension ID is ignored. |
57 // | 57 // |
58 // A renderer process may host multiple extensions when the browser hits the | 58 // A renderer process may host multiple extensions when the browser hits the |
59 // renderer process limit. In such case, we assign multiple extensions to | 59 // renderer process limit. In such case, we assign multiple extensions to |
60 // the same main world of a renderer process. In order to distinguish the | 60 // the same main world of a renderer process. In order to distinguish the |
61 // extensions and their activity loggers in the main world, we require an | 61 // extensions and their activity loggers in the main world, we require an |
62 // extension ID. Otherwise, extension activities may be logged under | 62 // extension ID. Otherwise, extension activities may be logged under |
63 // a wrong extension ID. | 63 // a wrong extension ID. |
64 static void setActivityLogger(int worldId, const String&, std::unique_ptr<V8
DOMActivityLogger>); | 64 static void setActivityLogger(int worldId, const String&, PassOwnPtr<V8DOMAc
tivityLogger>); |
65 static V8DOMActivityLogger* activityLogger(int worldId, const String& extens
ionId); | 65 static V8DOMActivityLogger* activityLogger(int worldId, const String& extens
ionId); |
66 static V8DOMActivityLogger* activityLogger(int worldId, const KURL&); | 66 static V8DOMActivityLogger* activityLogger(int worldId, const KURL&); |
67 | 67 |
68 // Returns activity logger for current V8 context or 0. | 68 // Returns activity logger for current V8 context or 0. |
69 static V8DOMActivityLogger* currentActivityLogger(); | 69 static V8DOMActivityLogger* currentActivityLogger(); |
70 // Returns activity logger for current V8 context if the context belongs to | 70 // Returns activity logger for current V8 context if the context belongs to |
71 // an isolated world or 0. | 71 // an isolated world or 0. |
72 static V8DOMActivityLogger* currentActivityLoggerIfIsolatedWorld(); | 72 static V8DOMActivityLogger* currentActivityLoggerIfIsolatedWorld(); |
73 | 73 |
74 }; | 74 }; |
75 | 75 |
76 } // namespace blink | 76 } // namespace blink |
77 | 77 |
78 #endif // V8DOMActivityLogger_h | 78 #endif // V8DOMActivityLogger_h |
OLD | NEW |