OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 29 matching lines...) Expand all Loading... |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 class InspectorClient; | 42 class InspectorClient; |
43 class InspectorDOMStorageAgent; | 43 class InspectorDOMStorageAgent; |
44 class InspectorState; | 44 class InspectorState; |
45 class InstrumentingAgents; | 45 class InstrumentingAgents; |
46 class Page; | 46 class Page; |
47 | 47 |
48 typedef String ErrorString; | 48 typedef String ErrorString; |
49 | 49 |
50 class InspectorMemoryAgent : public InspectorBaseAgent<InspectorMemoryAgent>, pu
blic InspectorBackendDispatcher::MemoryCommandHandler { | 50 class InspectorMemoryAgent : public InspectorBaseAgent, public InspectorBackendD
ispatcher::MemoryCommandHandler { |
51 WTF_MAKE_NONCOPYABLE(InspectorMemoryAgent); | 51 WTF_MAKE_NONCOPYABLE(InspectorMemoryAgent); |
52 public: | 52 public: |
53 typedef Vector<OwnPtr<InspectorBaseAgentInterface> > InspectorAgents; | 53 typedef Vector<OwnPtr<InspectorBaseAgent> > InspectorAgents; |
54 | 54 |
55 static PassOwnPtr<InspectorMemoryAgent> create(InstrumentingAgents* instrume
ntingAgents, InspectorClient* client, InspectorCompositeState* state, Page* page
) | 55 static PassRefPtr<InspectorMemoryAgent> create(InstrumentingAgents* instrume
ntingAgents, InspectorClient* client, InspectorState* state, Page* page) |
56 { | 56 { |
57 return adoptPtr(new InspectorMemoryAgent(instrumentingAgents, client, st
ate, page)); | 57 return adoptRef(new InspectorMemoryAgent(instrumentingAgents, client, st
ate, page)); |
58 } | 58 } |
59 virtual ~InspectorMemoryAgent(); | 59 virtual ~InspectorMemoryAgent(); |
60 | 60 |
61 virtual void getDOMCounters(ErrorString*, int* documents, int* nodes, int* j
sEventListeners); | 61 virtual void getDOMCounters(ErrorString*, int* documents, int* nodes, int* j
sEventListeners); |
62 virtual void getProcessMemoryDistribution(ErrorString*, const bool* reportGr
aph, RefPtr<TypeBuilder::Memory::MemoryBlock>& out_processMemory, RefPtr<Inspect
orObject>& graphMetaInformation); | 62 virtual void getProcessMemoryDistribution(ErrorString*, const bool* reportGr
aph, RefPtr<TypeBuilder::Memory::MemoryBlock>& out_processMemory, RefPtr<Inspect
orObject>& graphMetaInformation); |
63 | 63 |
64 virtual void reportMemoryUsage(MemoryObjectInfo*) const; | 64 virtual void reportMemoryUsage(MemoryObjectInfo*) const; |
65 | 65 |
66 void getProcessMemoryDistributionMap(HashMap<String, size_t>* memoryInfo); | 66 void getProcessMemoryDistributionMap(HashMap<String, size_t>* memoryInfo); |
67 | 67 |
68 virtual void setFrontend(InspectorFrontend*); | 68 virtual void setFrontend(InspectorFrontend*); |
69 virtual void clearFrontend(); | 69 virtual void clearFrontend(); |
70 | 70 |
71 private: | 71 private: |
72 InspectorMemoryAgent(InstrumentingAgents*, InspectorClient*, InspectorCompos
iteState*, Page*); | 72 InspectorMemoryAgent(InstrumentingAgents*, InspectorClient*, InspectorState*
, Page*); |
73 | 73 |
74 PassRefPtr<InspectorObject> getProcessMemoryDistributionImpl(bool reportGrap
h, HashMap<String, size_t>* memoryInfo); | 74 PassRefPtr<InspectorObject> getProcessMemoryDistributionImpl(bool reportGrap
h, HashMap<String, size_t>* memoryInfo); |
75 | 75 |
76 InspectorClient* m_inspectorClient; | 76 InspectorClient* m_inspectorClient; |
77 Page* m_page; | 77 Page* m_page; |
78 InspectorFrontend::Memory* m_frontend; | 78 InspectorFrontend::Memory* m_frontend; |
79 }; | 79 }; |
80 | 80 |
| 81 class InspectorMemoryFactory : public InspectorBaseFactory<InspectorMemoryFactor
y, InspectorMemoryAgent> { |
| 82 public: |
| 83 |
| 84 static PassOwnPtr<InspectorMemoryFactory> create(InstrumentingAgents* instru
mentingAgents, InspectorClient* client, InspectorCompositeState* compositeState,
Page* page) |
| 85 { |
| 86 return adoptPtr(new InspectorMemoryFactory(instrumentingAgents, client,
compositeState, page)); |
| 87 } |
| 88 |
| 89 protected: |
| 90 InspectorMemoryFactory(InstrumentingAgents* instrumentingAgents, InspectorCl
ient* client, InspectorCompositeState* compositeState, Page* page) |
| 91 : InspectorBaseFactory<InspectorMemoryFactory, InspectorMemoryAgent>("Me
mory", instrumentingAgents, compositeState) |
| 92 { |
| 93 setAgent(InspectorMemoryAgent::create(m_instrumentingAgents, client, m_s
tate, page)); |
| 94 } |
| 95 }; |
| 96 |
81 } // namespace WebCore | 97 } // namespace WebCore |
82 | 98 |
83 #endif // !defined(InspectorMemoryAgent_h) | 99 #endif // !defined(InspectorMemoryAgent_h) |
OLD | NEW |