| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple 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 15 matching lines...) Expand all Loading... |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef FrameConsole_h | 29 #ifndef FrameConsole_h |
| 30 #define FrameConsole_h | 30 #define FrameConsole_h |
| 31 | 31 |
| 32 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
| 33 #include "core/inspector/ConsoleTypes.h" | 33 #include "core/inspector/ConsoleTypes.h" |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
| 36 #include "wtf/text/WTFString.h" |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 class ConsoleMessage; | 40 class ConsoleMessage; |
| 40 class DocumentLoader; | 41 class DocumentLoader; |
| 41 class LocalFrame; | 42 class LocalFrame; |
| 42 class ResourceError; | 43 class ResourceError; |
| 43 class ResourceResponse; | 44 class ResourceResponse; |
| 44 class SourceLocation; | 45 class SourceLocation; |
| 45 | 46 |
| 46 // FrameConsole takes per-frame console messages and routes them up through the | 47 // FrameConsole takes per-frame console messages and routes them up through the |
| 47 // FrameHost to the ChromeClient and Inspector. It's meant as an abstraction | 48 // FrameHost to the ChromeClient and Inspector. It's meant as an abstraction |
| 48 // around ChromeClient calls and the way that Blink core/ can add messages to | 49 // around ChromeClient calls and the way that Blink core/ can add messages to |
| 49 // the console. | 50 // the console. |
| 50 class CORE_EXPORT FrameConsole final : public GarbageCollected<FrameConsole> { | 51 class CORE_EXPORT FrameConsole final |
| 52 : public GarbageCollectedFinalized<FrameConsole> { |
| 51 public: | 53 public: |
| 52 static FrameConsole* create(LocalFrame& frame) { | 54 static FrameConsole* create(LocalFrame& frame) { |
| 53 return new FrameConsole(frame); | 55 return new FrameConsole(frame); |
| 54 } | 56 } |
| 55 | 57 |
| 56 void addMessage(ConsoleMessage*); | 58 void addMessage(ConsoleMessage*); |
| 57 void addMessageFromWorker(MessageLevel, | 59 void addMessageFromWorker(MessageLevel, |
| 58 const String& message, | 60 const String& message, |
| 59 std::unique_ptr<SourceLocation>, | 61 std::unique_ptr<SourceLocation>, |
| 60 const String& workerId); | 62 const String& workerId); |
| 61 | 63 |
| 64 // Show the specified ConsoleMessage only if the frame haven't shown a message |
| 65 // same as ConsoleMessage::messsage(). |
| 66 void addSingletonMessage(ConsoleMessage*); |
| 67 |
| 62 bool addMessageToStorage(ConsoleMessage*); | 68 bool addMessageToStorage(ConsoleMessage*); |
| 63 void reportMessageToClient(MessageSource, | 69 void reportMessageToClient(MessageSource, |
| 64 MessageLevel, | 70 MessageLevel, |
| 65 const String& message, | 71 const String& message, |
| 66 SourceLocation*); | 72 SourceLocation*); |
| 67 | 73 |
| 68 void reportResourceResponseReceived(DocumentLoader*, | 74 void reportResourceResponseReceived(DocumentLoader*, |
| 69 unsigned long requestIdentifier, | 75 unsigned long requestIdentifier, |
| 70 const ResourceResponse&); | 76 const ResourceResponse&); |
| 71 | 77 |
| 72 void didFailLoading(unsigned long requestIdentifier, const ResourceError&); | 78 void didFailLoading(unsigned long requestIdentifier, const ResourceError&); |
| 73 | 79 |
| 74 DECLARE_TRACE(); | 80 DECLARE_TRACE(); |
| 75 | 81 |
| 76 private: | 82 private: |
| 77 explicit FrameConsole(LocalFrame&); | 83 explicit FrameConsole(LocalFrame&); |
| 78 | 84 |
| 79 Member<LocalFrame> m_frame; | 85 Member<LocalFrame> m_frame; |
| 86 HashSet<String> m_singletonMessages; |
| 80 }; | 87 }; |
| 81 | 88 |
| 82 } // namespace blink | 89 } // namespace blink |
| 83 | 90 |
| 84 #endif // FrameConsole_h | 91 #endif // FrameConsole_h |
| OLD | NEW |