| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2013 Google Inc. All rights reserved. |    2  * Copyright (C) 2013 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 InspectorHeapProfilerAgent_h |   31 #ifndef InspectorHeapProfilerAgent_h | 
|   32 #define InspectorHeapProfilerAgent_h |   32 #define InspectorHeapProfilerAgent_h | 
|   33  |   33  | 
|   34  |   34  | 
|   35 #include "InspectorBaseAgent.h" |   35 #include "InspectorBaseAgent.h" | 
|   36 #include "InspectorFrontend.h" |   36 #include "InspectorFrontend.h" | 
|   37 #include <wtf/Forward.h> |   37 #include <wtf/Forward.h> | 
|   38 #include <wtf/HashMap.h> |   38 #include <wtf/HashMap.h> | 
|   39 #include <wtf/Noncopyable.h> |   39 #include <wtf/Noncopyable.h> | 
 |   40 #include <wtf/OwnPtr.h> | 
|   40 #include <wtf/PassOwnPtr.h> |   41 #include <wtf/PassOwnPtr.h> | 
|   41 #include <wtf/text/WTFString.h> |   42 #include <wtf/text/WTFString.h> | 
|   42  |   43  | 
|   43 namespace WebCore { |   44 namespace WebCore { | 
|   44  |   45  | 
 |   46 class HeapObjectsStatsStream; | 
|   45 class InjectedScriptManager; |   47 class InjectedScriptManager; | 
 |   48 class HeapStatsUpdateTask; | 
|   46 class ScriptHeapSnapshot; |   49 class ScriptHeapSnapshot; | 
|   47 class ScriptProfile; |   50 class ScriptProfile; | 
|   48  |   51  | 
|   49 typedef String ErrorString; |   52 typedef String ErrorString; | 
|   50  |   53  | 
|   51 class InspectorHeapProfilerAgent : public InspectorBaseAgent<InspectorHeapProfil
     erAgent>, public InspectorBackendDispatcher::HeapProfilerCommandHandler { |   54 class InspectorHeapProfilerAgent : public InspectorBaseAgent<InspectorHeapProfil
     erAgent>, public InspectorBackendDispatcher::HeapProfilerCommandHandler { | 
|   52     WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED; |   55     WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED; | 
|   53 public: |   56 public: | 
|   54     static PassOwnPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, I
     nspectorCompositeState*, InjectedScriptManager*); |   57     static PassOwnPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, I
     nspectorCompositeState*, InjectedScriptManager*); | 
|   55     virtual ~InspectorHeapProfilerAgent(); |   58     virtual ~InspectorHeapProfilerAgent(); | 
|   56  |   59  | 
|   57     virtual void collectGarbage(ErrorString*); |   60     virtual void collectGarbage(ErrorString*); | 
|   58     virtual void clearProfiles(ErrorString*); |   61     virtual void clearProfiles(ErrorString*); | 
|   59  |   62  | 
|   60     virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeB
     uilder::HeapProfiler::ProfileHeader> >&); |   63     virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeB
     uilder::HeapProfiler::ProfileHeader> >&); | 
|   61     virtual void getHeapSnapshot(ErrorString*, int uid); |   64     virtual void getHeapSnapshot(ErrorString*, int uid); | 
|   62     virtual void removeProfile(ErrorString*, int uid); |   65     virtual void removeProfile(ErrorString*, int uid); | 
 |   66     virtual void startTrackingHeapObjects(ErrorString*); | 
 |   67     virtual void stopTrackingHeapObjects(ErrorString*); | 
|   63  |   68  | 
|   64     virtual void setFrontend(InspectorFrontend*); |   69     virtual void setFrontend(InspectorFrontend*); | 
|   65     virtual void clearFrontend(); |   70     virtual void clearFrontend(); | 
|   66     virtual void restore(); |   71     virtual void restore(); | 
|   67  |   72  | 
|   68     virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress); |   73     virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress); | 
|   69  |   74  | 
|   70     virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapsho
     tObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
     & result); |   75     virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapsho
     tObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
     & result); | 
|   71     virtual void getHeapObjectId(ErrorString*, const String& objectId, String* h
     eapSnapshotObjectId); |   76     virtual void getHeapObjectId(ErrorString*, const String& objectId, String* h
     eapSnapshotObjectId); | 
|   72  |   77  | 
|   73     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |   78     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 
|   74  |   79  | 
 |   80  | 
|   75 private: |   81 private: | 
 |   82     class HeapStatsStream; | 
 |   83     class HeapStatsUpdateTask; | 
 |   84  | 
|   76     InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorCompositeState*, I
     njectedScriptManager*); |   85     InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorCompositeState*, I
     njectedScriptManager*); | 
|   77  |   86  | 
|   78     typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap; |   87     typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap; | 
|   79  |   88  | 
|   80     void resetFrontendProfiles(); |   89     void resetFrontendProfiles(); | 
 |   90     void requestHeapStatsUpdate(); | 
 |   91     void pushHeapStatsUpdate(const uint32_t* const data, const int size); | 
|   81  |   92  | 
|   82     PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(co
     nst ScriptHeapSnapshot&); |   93     PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(co
     nst ScriptHeapSnapshot&); | 
|   83  |   94  | 
|   84     InjectedScriptManager* m_injectedScriptManager; |   95     InjectedScriptManager* m_injectedScriptManager; | 
|   85     InspectorFrontend::HeapProfiler* m_frontend; |   96     InspectorFrontend::HeapProfiler* m_frontend; | 
|   86     unsigned m_nextUserInitiatedHeapSnapshotNumber; |   97     unsigned m_nextUserInitiatedHeapSnapshotNumber; | 
|   87     IdToHeapSnapshotMap m_snapshots; |   98     IdToHeapSnapshotMap m_snapshots; | 
 |   99     OwnPtr<HeapStatsUpdateTask> m_heapStatsUpdateTask; | 
|   88 }; |  100 }; | 
|   89  |  101  | 
|   90 } // namespace WebCore |  102 } // namespace WebCore | 
|   91  |  103  | 
|   92  |  104  | 
|   93 #endif // !defined(InspectorHeapProfilerAgent_h) |  105 #endif // !defined(InspectorHeapProfilerAgent_h) | 
| OLD | NEW |