InstrumentingAgents.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * Copyright (C) 2011 Google Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above
  11. * copyright notice, this list of conditions and the following disclaimer
  12. * in the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Google Inc. nor the names of its
  15. * contributors may be used to endorse or promote products derived from
  16. * this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef InstrumentingAgents_h
  31. #define InstrumentingAgents_h
  32. #include <wtf/FastAllocBase.h>
  33. #include <wtf/Noncopyable.h>
  34. #include <wtf/PassRefPtr.h>
  35. #include <wtf/RefCounted.h>
  36. namespace WebCore {
  37. class InspectorAgent;
  38. class InspectorApplicationCacheAgent;
  39. class InspectorCSSAgent;
  40. class InspectorCanvasAgent;
  41. class InspectorConsoleAgent;
  42. class InspectorDOMAgent;
  43. class InspectorDOMDebuggerAgent;
  44. class InspectorDOMStorageAgent;
  45. class InspectorDatabaseAgent;
  46. class InspectorDebuggerAgent;
  47. class InspectorFileSystemAgent;
  48. class InspectorHeapProfilerAgent;
  49. class InspectorLayerTreeAgent;
  50. class InspectorPageAgent;
  51. class InspectorProfilerAgent;
  52. class InspectorResourceAgent;
  53. class InspectorTimelineAgent;
  54. class InspectorWorkerAgent;
  55. class Page;
  56. class PageDebuggerAgent;
  57. class PageRuntimeAgent;
  58. class WorkerContext;
  59. class WorkerRuntimeAgent;
  60. class InstrumentingAgents : public RefCounted<InstrumentingAgents> {
  61. WTF_MAKE_NONCOPYABLE(InstrumentingAgents);
  62. WTF_MAKE_FAST_ALLOCATED;
  63. public:
  64. static PassRefPtr<InstrumentingAgents> create()
  65. {
  66. return adoptRef(new InstrumentingAgents());
  67. }
  68. ~InstrumentingAgents() { }
  69. void reset();
  70. InspectorAgent* inspectorAgent() const { return m_inspectorAgent; }
  71. void setInspectorAgent(InspectorAgent* agent) { m_inspectorAgent = agent; }
  72. InspectorPageAgent* inspectorPageAgent() const { return m_inspectorPageAgent; }
  73. void setInspectorPageAgent(InspectorPageAgent* agent) { m_inspectorPageAgent = agent; }
  74. InspectorCSSAgent* inspectorCSSAgent() const { return m_inspectorCSSAgent; }
  75. void setInspectorCSSAgent(InspectorCSSAgent* agent) { m_inspectorCSSAgent = agent; }
  76. InspectorConsoleAgent* inspectorConsoleAgent() const { return m_inspectorConsoleAgent; }
  77. void setInspectorConsoleAgent(InspectorConsoleAgent* agent) { m_inspectorConsoleAgent = agent; }
  78. InspectorDOMAgent* inspectorDOMAgent() const { return m_inspectorDOMAgent; }
  79. void setInspectorDOMAgent(InspectorDOMAgent* agent) { m_inspectorDOMAgent = agent; }
  80. InspectorResourceAgent* inspectorResourceAgent() const { return m_inspectorResourceAgent; }
  81. void setInspectorResourceAgent(InspectorResourceAgent* agent) { m_inspectorResourceAgent = agent; }
  82. PageRuntimeAgent* pageRuntimeAgent() const { return m_pageRuntimeAgent; }
  83. void setPageRuntimeAgent(PageRuntimeAgent* agent) { m_pageRuntimeAgent = agent; }
  84. WorkerRuntimeAgent* workerRuntimeAgent() const { return m_workerRuntimeAgent; }
  85. void setWorkerRuntimeAgent(WorkerRuntimeAgent* agent) { m_workerRuntimeAgent = agent; }
  86. InspectorTimelineAgent* inspectorTimelineAgent() const { return m_inspectorTimelineAgent; }
  87. void setInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_inspectorTimelineAgent = agent; }
  88. InspectorDOMStorageAgent* inspectorDOMStorageAgent() const { return m_inspectorDOMStorageAgent; }
  89. void setInspectorDOMStorageAgent(InspectorDOMStorageAgent* agent) { m_inspectorDOMStorageAgent = agent; }
  90. #if ENABLE(SQL_DATABASE)
  91. InspectorDatabaseAgent* inspectorDatabaseAgent() const { return m_inspectorDatabaseAgent; }
  92. void setInspectorDatabaseAgent(InspectorDatabaseAgent* agent) { m_inspectorDatabaseAgent = agent; }
  93. #endif
  94. #if ENABLE(FILE_SYSTEM)
  95. InspectorFileSystemAgent* inspectorFileSystemAgent() const { return m_inspectorFileSystemAgent; }
  96. void setInspectorFileSystemAgent(InspectorFileSystemAgent* agent) { m_inspectorFileSystemAgent = agent; }
  97. #endif
  98. InspectorApplicationCacheAgent* inspectorApplicationCacheAgent() const { return m_inspectorApplicationCacheAgent; }
  99. void setInspectorApplicationCacheAgent(InspectorApplicationCacheAgent* agent) { m_inspectorApplicationCacheAgent = agent; }
  100. #if ENABLE(JAVASCRIPT_DEBUGGER)
  101. InspectorDebuggerAgent* inspectorDebuggerAgent() const { return m_inspectorDebuggerAgent; }
  102. void setInspectorDebuggerAgent(InspectorDebuggerAgent* agent) { m_inspectorDebuggerAgent = agent; }
  103. PageDebuggerAgent* pageDebuggerAgent() const { return m_pageDebuggerAgent; }
  104. void setPageDebuggerAgent(PageDebuggerAgent* agent) { m_pageDebuggerAgent = agent; }
  105. InspectorDOMDebuggerAgent* inspectorDOMDebuggerAgent() const { return m_inspectorDOMDebuggerAgent; }
  106. void setInspectorDOMDebuggerAgent(InspectorDOMDebuggerAgent* agent) { m_inspectorDOMDebuggerAgent = agent; }
  107. InspectorProfilerAgent* inspectorProfilerAgent() const { return m_inspectorProfilerAgent; }
  108. void setInspectorProfilerAgent(InspectorProfilerAgent* agent) { m_inspectorProfilerAgent = agent; }
  109. InspectorHeapProfilerAgent* inspectorHeapProfilerAgent() const { return m_inspectorHeapProfilerAgent; }
  110. void setInspectorHeapProfilerAgent(InspectorHeapProfilerAgent* agent) { m_inspectorHeapProfilerAgent = agent; }
  111. #endif
  112. #if ENABLE(WORKERS)
  113. InspectorWorkerAgent* inspectorWorkerAgent() const { return m_inspectorWorkerAgent; }
  114. void setInspectorWorkerAgent(InspectorWorkerAgent* agent) { m_inspectorWorkerAgent = agent; }
  115. #endif
  116. InspectorCanvasAgent* inspectorCanvasAgent() const { return m_inspectorCanvasAgent; }
  117. void setInspectorCanvasAgent(InspectorCanvasAgent* agent) { m_inspectorCanvasAgent = agent; }
  118. #if USE(ACCELERATED_COMPOSITING)
  119. InspectorLayerTreeAgent* inspectorLayerTreeAgent() const { return m_inspectorLayerTreeAgent; }
  120. void setInspectorLayerTreeAgent(InspectorLayerTreeAgent* agent) { m_inspectorLayerTreeAgent = agent; }
  121. #endif
  122. private:
  123. InstrumentingAgents();
  124. InspectorAgent* m_inspectorAgent;
  125. InspectorPageAgent* m_inspectorPageAgent;
  126. InspectorCSSAgent* m_inspectorCSSAgent;
  127. #if USE(ACCELERATED_COMPOSITING)
  128. InspectorLayerTreeAgent* m_inspectorLayerTreeAgent;
  129. #endif
  130. InspectorConsoleAgent* m_inspectorConsoleAgent;
  131. InspectorDOMAgent* m_inspectorDOMAgent;
  132. InspectorResourceAgent* m_inspectorResourceAgent;
  133. PageRuntimeAgent* m_pageRuntimeAgent;
  134. WorkerRuntimeAgent* m_workerRuntimeAgent;
  135. InspectorTimelineAgent* m_inspectorTimelineAgent;
  136. InspectorDOMStorageAgent* m_inspectorDOMStorageAgent;
  137. #if ENABLE(SQL_DATABASE)
  138. InspectorDatabaseAgent* m_inspectorDatabaseAgent;
  139. #endif
  140. #if ENABLE(FILE_SYSTEM)
  141. InspectorFileSystemAgent* m_inspectorFileSystemAgent;
  142. #endif
  143. InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent;
  144. #if ENABLE(JAVASCRIPT_DEBUGGER)
  145. InspectorDebuggerAgent* m_inspectorDebuggerAgent;
  146. PageDebuggerAgent* m_pageDebuggerAgent;
  147. InspectorDOMDebuggerAgent* m_inspectorDOMDebuggerAgent;
  148. InspectorProfilerAgent* m_inspectorProfilerAgent;
  149. InspectorHeapProfilerAgent* m_inspectorHeapProfilerAgent;
  150. #endif
  151. #if ENABLE(WORKERS)
  152. InspectorWorkerAgent* m_inspectorWorkerAgent;
  153. #endif
  154. InspectorCanvasAgent* m_inspectorCanvasAgent;
  155. };
  156. InstrumentingAgents* instrumentationForPage(Page*);
  157. #if ENABLE(WORKERS)
  158. InstrumentingAgents* instrumentationForWorkerContext(WorkerContext*);
  159. #endif
  160. }
  161. #endif // !defined(InstrumentingAgents_h)