| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef V8DOMActivityLogger_h | 31 #ifndef V8DOMActivityLogger_h |
| 32 #define V8DOMActivityLogger_h | 32 #define V8DOMActivityLogger_h |
| 33 | 33 |
| 34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 35 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
| 36 #include <v8.h> | 36 #include <v8.h> |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 class KURL; |
| 41 |
| 40 class V8DOMActivityLogger { | 42 class V8DOMActivityLogger { |
| 41 public: | 43 public: |
| 42 virtual ~V8DOMActivityLogger() { } | 44 virtual ~V8DOMActivityLogger() { } |
| 43 | 45 |
| 44 virtual void logGetter(const String& apiName) { } | 46 virtual void logGetter(const String& apiName) { } |
| 45 virtual void logSetter(const String& apiName, const v8::Handle<v8::Value>& n
ewValue) { } | 47 virtual void logSetter(const String& apiName, const v8::Handle<v8::Value>& n
ewValue) { } |
| 46 virtual void logSetter(const String& apiName, const v8::Handle<v8::Value>& n
ewValue, const v8::Handle<v8::Value>& oldValue) { } | 48 virtual void logSetter(const String& apiName, const v8::Handle<v8::Value>& n
ewValue, const v8::Handle<v8::Value>& oldValue) { } |
| 47 virtual void logMethod(const String& apiName, int argc, const v8::Handle<v8:
:Value>* argv) { } | 49 virtual void logMethod(const String& apiName, int argc, const v8::Handle<v8:
:Value>* argv) { } |
| 48 | 50 |
| 49 // Associates a logger with the world identified by worldId (worlId may be 0 | 51 // Associates a logger with the world identified by worldId (worlId may be 0 |
| 50 // identifying the main world). | 52 // identifying the main world) and extension ID. Extension ID is used to |
| 51 static void setActivityLogger(int worldId, PassOwnPtr<V8DOMActivityLogger>); | 53 // identify a logger for main world only (worldId == 0). If the world is not |
| 52 static V8DOMActivityLogger* activityLogger(int worldId); | 54 // a main world, an extension ID is ignored. |
| 55 // |
| 56 // A render process may host multiple extensions when the browser hits a |
| 57 // renderer process limit. Thus, within a single render there may be |
| 58 // multiple main worlds (worldId == 0) that corresponds to different |
| 59 // extensions. In order to find an appropriate logger for an extension's |
| 60 // main world in such cases, we require an extension ID. Otherwise, |
| 61 // extension activities may be logged under a wrong extension ID. |
| 62 static void setActivityLogger(int worldId, const String&, PassOwnPtr<V8DOMAc
tivityLogger>); |
| 63 static V8DOMActivityLogger* activityLogger(int worldId, const String&); |
| 64 static V8DOMActivityLogger* activityLogger(int worldId, const KURL&); |
| 65 |
| 53 }; | 66 }; |
| 54 | 67 |
| 55 } // namespace WebCore | 68 } // namespace WebCore |
| 56 | 69 |
| 57 #endif // V8DOMActivityLogger_h | 70 #endif // V8DOMActivityLogger_h |
| OLD | NEW |