| 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 26 matching lines...) Expand all Loading... |
| 37 #include <wtf/HashMap.h> | 37 #include <wtf/HashMap.h> |
| 38 #include <wtf/Noncopyable.h> | 38 #include <wtf/Noncopyable.h> |
| 39 #include <wtf/PassOwnPtr.h> | 39 #include <wtf/PassOwnPtr.h> |
| 40 #include <wtf/text/WTFString.h> | 40 #include <wtf/text/WTFString.h> |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class InjectedScriptManager; | 44 class InjectedScriptManager; |
| 45 class InspectorArray; | 45 class InspectorArray; |
| 46 class InspectorConsoleAgent; | 46 class InspectorConsoleAgent; |
| 47 class InspectorConsoleController; |
| 47 class InspectorFrontend; | 48 class InspectorFrontend; |
| 48 class InspectorObject; | 49 class InspectorObject; |
| 49 class InspectorState; | 50 class InspectorState; |
| 50 class InstrumentingAgents; | 51 class InstrumentingAgents; |
| 51 class Page; | 52 class Page; |
| 52 class ScriptCallStack; | 53 class ScriptCallStack; |
| 53 class ScriptProfile; | 54 class ScriptProfile; |
| 54 class WorkerContext; | 55 class WorkerContext; |
| 55 | 56 |
| 56 typedef String ErrorString; | 57 typedef String ErrorString; |
| 57 | 58 |
| 58 class InspectorProfilerAgent : public InspectorBaseAgent<InspectorProfilerAgent>
, public InspectorBackendDispatcher::ProfilerCommandHandler { | 59 class InspectorProfilerAgent : public InspectorBaseAgent, public InspectorBacken
dDispatcher::ProfilerCommandHandler { |
| 59 WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED; | 60 WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED; |
| 60 public: | 61 public: |
| 61 static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, Inspe
ctorConsoleAgent*, InspectorCompositeState*, InjectedScriptManager*); | 62 static PassRefPtr<InspectorProfilerAgent> create(InstrumentingAgents*, Inspe
ctorState*, PassRefPtr<InspectorConsoleAgent>, InjectedScriptManager*); |
| 62 virtual ~InspectorProfilerAgent(); | 63 virtual ~InspectorProfilerAgent(); |
| 63 | 64 |
| 64 void addProfile(PassRefPtr<ScriptProfile> prpProfile, PassRefPtr<ScriptCallS
tack>); | 65 void addProfile(PassRefPtr<ScriptProfile> prpProfile, PassRefPtr<ScriptCallS
tack>); |
| 65 void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned
lineNumber, const String& sourceURL); | 66 void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned
lineNumber, const String& sourceURL); |
| 66 void addStartProfilingMessageToConsole(const String& title, unsigned lineNum
ber, const String& sourceURL); | 67 void addStartProfilingMessageToConsole(const String& title, unsigned lineNum
ber, const String& sourceURL); |
| 67 virtual void clearProfiles(ErrorString*); | 68 virtual void clearProfiles(ErrorString*); |
| 68 | 69 |
| 69 virtual void enable(ErrorString*); | 70 virtual void enable(ErrorString*); |
| 70 virtual void disable(ErrorString*); | 71 virtual void disable(ErrorString*); |
| 71 virtual void start(ErrorString* = 0); | 72 virtual void start(ErrorString* = 0); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 82 virtual void restore(); | 83 virtual void restore(); |
| 83 | 84 |
| 84 void toggleRecordButton(bool isProfiling); | 85 void toggleRecordButton(bool isProfiling); |
| 85 | 86 |
| 86 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 87 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
| 87 | 88 |
| 88 void willProcessTask(); | 89 void willProcessTask(); |
| 89 void didProcessTask(); | 90 void didProcessTask(); |
| 90 | 91 |
| 91 private: | 92 private: |
| 92 InspectorProfilerAgent(InstrumentingAgents*, InspectorConsoleAgent*, Inspect
orCompositeState*, InjectedScriptManager*); | 93 InspectorProfilerAgent(InstrumentingAgents*, InspectorState*, PassRefPtr<Ins
pectorConsoleAgent>, InjectedScriptManager*); |
| 93 | 94 |
| 94 void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, c
onst String& sourceURL); | 95 void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, c
onst String& sourceURL); |
| 95 | 96 |
| 96 void resetFrontendProfiles(); | 97 void resetFrontendProfiles(); |
| 97 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> stop(ErrorString* = 0); | 98 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> stop(ErrorString* = 0); |
| 98 | 99 |
| 99 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> createProfileHeader(const S
criptProfile&); | 100 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> createProfileHeader(const S
criptProfile&); |
| 100 | 101 |
| 101 InspectorConsoleAgent* m_consoleAgent; | 102 RefPtr<InspectorConsoleAgent> m_consoleAgent; |
| 102 InjectedScriptManager* m_injectedScriptManager; | 103 InjectedScriptManager* m_injectedScriptManager; |
| 103 InspectorFrontend::Profiler* m_frontend; | 104 InspectorFrontend::Profiler* m_frontend; |
| 104 bool m_recordingCPUProfile; | 105 bool m_recordingCPUProfile; |
| 105 int m_currentUserInitiatedProfileNumber; | 106 int m_currentUserInitiatedProfileNumber; |
| 106 unsigned m_nextUserInitiatedProfileNumber; | 107 unsigned m_nextUserInitiatedProfileNumber; |
| 107 typedef HashMap<unsigned, RefPtr<ScriptProfile> > ProfilesMap; | 108 typedef HashMap<unsigned, RefPtr<ScriptProfile> > ProfilesMap; |
| 108 ProfilesMap m_profiles; | 109 ProfilesMap m_profiles; |
| 109 | 110 |
| 110 typedef HashMap<String, double> ProfileNameIdleTimeMap; | 111 typedef HashMap<String, double> ProfileNameIdleTimeMap; |
| 111 ProfileNameIdleTimeMap* m_profileNameIdleTimeMap; | 112 ProfileNameIdleTimeMap* m_profileNameIdleTimeMap; |
| 112 double m_previousTaskEndTime; | 113 double m_previousTaskEndTime; |
| 113 }; | 114 }; |
| 114 | 115 |
| 116 class InspectorProfilerController: public InspectorBaseController<InspectorProfi
lerController, InspectorProfilerAgent> { |
| 117 public: |
| 118 |
| 119 static PassOwnPtr<InspectorProfilerController> create(InstrumentingAgents* i
nstrumentingAgents, InspectorCompositeState* compositeState, InspectorConsoleCon
troller* consoleController, InjectedScriptManager* injectedScriptManager) |
| 120 { |
| 121 return adoptPtr(new InspectorProfilerController(instrumentingAgents, com
positeState, consoleController, injectedScriptManager)); |
| 122 } |
| 123 |
| 124 protected: |
| 125 InspectorProfilerController(InstrumentingAgents*, InspectorCompositeState*,
InspectorConsoleController*, InjectedScriptManager*); |
| 126 }; |
| 127 |
| 115 } // namespace WebCore | 128 } // namespace WebCore |
| 116 | 129 |
| 117 | 130 |
| 118 #endif // !defined(InspectorProfilerAgent_h) | 131 #endif // !defined(InspectorProfilerAgent_h) |
| OLD | NEW |