InstrumentingAgents.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. #include "config.h"
  31. #if ENABLE(INSPECTOR)
  32. #include "InstrumentingAgents.h"
  33. #include "InspectorController.h"
  34. #include "Page.h"
  35. #include "WorkerContext.h"
  36. #include "WorkerInspectorController.h"
  37. #include <wtf/MainThread.h>
  38. namespace WebCore {
  39. InstrumentingAgents::InstrumentingAgents()
  40. : m_inspectorAgent(0)
  41. , m_inspectorPageAgent(0)
  42. , m_inspectorCSSAgent(0)
  43. #if USE(ACCELERATED_COMPOSITING)
  44. , m_inspectorLayerTreeAgent(0)
  45. #endif
  46. , m_inspectorConsoleAgent(0)
  47. , m_inspectorDOMAgent(0)
  48. , m_inspectorResourceAgent(0)
  49. , m_pageRuntimeAgent(0)
  50. , m_workerRuntimeAgent(0)
  51. , m_inspectorTimelineAgent(0)
  52. , m_inspectorDOMStorageAgent(0)
  53. #if ENABLE(SQL_DATABASE)
  54. , m_inspectorDatabaseAgent(0)
  55. #endif
  56. #if ENABLE(FILE_SYSTEM)
  57. , m_inspectorFileSystemAgent(0)
  58. #endif
  59. , m_inspectorApplicationCacheAgent(0)
  60. #if ENABLE(JAVASCRIPT_DEBUGGER)
  61. , m_inspectorDebuggerAgent(0)
  62. , m_pageDebuggerAgent(0)
  63. , m_inspectorDOMDebuggerAgent(0)
  64. , m_inspectorProfilerAgent(0)
  65. #endif
  66. #if ENABLE(WORKERS)
  67. , m_inspectorWorkerAgent(0)
  68. #endif
  69. , m_inspectorCanvasAgent(0)
  70. {
  71. }
  72. void InstrumentingAgents::reset()
  73. {
  74. m_inspectorAgent = 0;
  75. m_inspectorPageAgent = 0;
  76. m_inspectorCSSAgent = 0;
  77. #if USE(ACCELERATED_COMPOSITING)
  78. m_inspectorLayerTreeAgent = 0;
  79. #endif
  80. m_inspectorConsoleAgent = 0;
  81. m_inspectorDOMAgent = 0;
  82. m_inspectorResourceAgent = 0;
  83. m_pageRuntimeAgent = 0;
  84. m_workerRuntimeAgent = 0;
  85. m_inspectorTimelineAgent = 0;
  86. m_inspectorDOMStorageAgent = 0;
  87. #if ENABLE(SQL_DATABASE)
  88. m_inspectorDatabaseAgent = 0;
  89. #endif
  90. #if ENABLE(FILE_SYSTEM)
  91. m_inspectorFileSystemAgent = 0;
  92. #endif
  93. m_inspectorApplicationCacheAgent = 0;
  94. #if ENABLE(JAVASCRIPT_DEBUGGER)
  95. m_inspectorDebuggerAgent = 0;
  96. m_pageDebuggerAgent = 0;
  97. m_inspectorDOMDebuggerAgent = 0;
  98. m_inspectorProfilerAgent = 0;
  99. #endif
  100. #if ENABLE(WORKERS)
  101. m_inspectorWorkerAgent = 0;
  102. #endif
  103. m_inspectorCanvasAgent = 0;
  104. }
  105. InstrumentingAgents* instrumentationForPage(Page* page)
  106. {
  107. ASSERT(isMainThread());
  108. if (InspectorController* controller = page->inspectorController())
  109. return controller->m_instrumentingAgents.get();
  110. return 0;
  111. }
  112. #if ENABLE(WORKERS)
  113. InstrumentingAgents* instrumentationForWorkerContext(WorkerContext* workerContext)
  114. {
  115. if (WorkerInspectorController* controller = workerContext->workerInspectorController())
  116. return controller->m_instrumentingAgents.get();
  117. return 0;
  118. }
  119. #endif
  120. } // namespace WebCore
  121. #endif // ENABLE(INSPECTOR)