OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 namespace v8 { | 42 namespace v8 { |
43 class CpuProfile; | 43 class CpuProfile; |
44 } | 44 } |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class ExecutionContext; | 48 class ExecutionContext; |
49 class InjectedScriptManager; | 49 class InjectedScriptManager; |
50 class InspectorFrontend; | 50 class InspectorFrontend; |
51 class InspectorOverlay; | |
52 | 51 |
53 typedef String ErrorString; | 52 typedef String ErrorString; |
54 | 53 |
55 class CORE_EXPORT InspectorProfilerAgent final : public InspectorBaseAgent<Inspe
ctorProfilerAgent, InspectorFrontend::Profiler>, public InspectorBackendDispatch
er::ProfilerCommandHandler { | 54 class CORE_EXPORT InspectorProfilerAgent final : public InspectorBaseAgent<Inspe
ctorProfilerAgent, InspectorFrontend::Profiler>, public InspectorBackendDispatch
er::ProfilerCommandHandler { |
56 WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); | 55 WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); |
57 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InspectorProfilerAgent); | 56 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(InspectorProfilerAgent); |
58 public: | 57 public: |
59 static PassOwnPtrWillBeRawPtr<InspectorProfilerAgent> create(v8::Isolate*, I
njectedScriptManager*, InspectorOverlay*); | 58 class Client { |
| 59 public: |
| 60 virtual ~Client() { } |
| 61 virtual void profilingStarted() { } |
| 62 virtual void profilingStopped() { } |
| 63 }; |
| 64 |
| 65 static PassOwnPtrWillBeRawPtr<InspectorProfilerAgent> create(v8::Isolate*, I
njectedScriptManager*, Client*); |
60 ~InspectorProfilerAgent() override; | 66 ~InspectorProfilerAgent() override; |
61 DECLARE_VIRTUAL_TRACE(); | 67 DECLARE_VIRTUAL_TRACE(); |
62 | 68 |
63 void consoleProfile(ExecutionContext*, const String& title); | 69 void consoleProfile(ExecutionContext*, const String& title); |
64 void consoleProfileEnd(const String& title); | 70 void consoleProfileEnd(const String& title); |
65 | 71 |
66 void enable(ErrorString*) override; | 72 void enable(ErrorString*) override; |
67 void setSamplingInterval(ErrorString*, int) override; | 73 void setSamplingInterval(ErrorString*, int) override; |
68 void start(ErrorString*) override; | 74 void start(ErrorString*) override; |
69 void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>&) override
; | 75 void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>&) override
; |
70 | 76 |
71 void disable(ErrorString*) override; | 77 void disable(ErrorString*) override; |
72 void restore() override; | 78 void restore() override; |
73 | 79 |
74 void willProcessTask(); | 80 void willProcessTask(); |
75 void didProcessTask(); | 81 void didProcessTask(); |
76 void willEnterNestedRunLoop(); | 82 void willEnterNestedRunLoop(); |
77 void didLeaveNestedRunLoop(); | 83 void didLeaveNestedRunLoop(); |
78 | 84 |
79 private: | 85 private: |
80 InspectorProfilerAgent(v8::Isolate*, InjectedScriptManager*, InspectorOverla
y*); | 86 InspectorProfilerAgent(v8::Isolate*, InjectedScriptManager*, Client*); |
81 bool enabled(); | 87 bool enabled(); |
82 void doEnable(); | 88 void doEnable(); |
83 void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>*); | 89 void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>*); |
84 String nextProfileId(); | 90 String nextProfileId(); |
85 | 91 |
86 void startProfiling(const String& title); | 92 void startProfiling(const String& title); |
87 PassRefPtr<TypeBuilder::Profiler::CPUProfile> stopProfiling(const String& ti
tle, bool serialize); | 93 PassRefPtr<TypeBuilder::Profiler::CPUProfile> stopProfiling(const String& ti
tle, bool serialize); |
88 | 94 |
89 bool isRecording() const; | 95 bool isRecording() const; |
90 void idleStarted(); | 96 void idleStarted(); |
91 void idleFinished(); | 97 void idleFinished(); |
92 | 98 |
93 v8::Isolate* m_isolate; | 99 v8::Isolate* m_isolate; |
94 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | 100 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; |
95 bool m_recordingCPUProfile; | 101 bool m_recordingCPUProfile; |
96 class ProfileDescriptor; | 102 class ProfileDescriptor; |
97 Vector<ProfileDescriptor> m_startedProfiles; | 103 Vector<ProfileDescriptor> m_startedProfiles; |
98 String m_frontendInitiatedProfileId; | 104 String m_frontendInitiatedProfileId; |
99 RawPtrWillBeMember<InspectorOverlay> m_overlay; | 105 Client* m_client; |
100 }; | 106 }; |
101 | 107 |
102 } // namespace blink | 108 } // namespace blink |
103 | 109 |
104 | 110 |
105 #endif // !defined(InspectorProfilerAgent_h) | 111 #endif // !defined(InspectorProfilerAgent_h) |
OLD | NEW |