OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 5 #ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/public/common/console_message_level.h" | 15 #include "content/public/common/console_message_level.h" |
16 #include "content/public/renderer/render_view_observer.h" | 16 #include "content/public/renderer/render_frame_observer.h" |
17 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h" | 17 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 class WebDevToolsAgent; | 20 class WebDevToolsAgent; |
21 } | 21 } |
22 | 22 |
23 struct GpuTaskInfo; | 23 struct GpuTaskInfo; |
24 | 24 |
25 namespace content { | 25 namespace content { |
| 26 |
26 class RenderViewImpl; | 27 class RenderViewImpl; |
27 | 28 |
28 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's | 29 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's |
29 // agents with the communication capabilities. All messages from/to Glue's | 30 // agents with the communication capabilities. All messages from/to Glue's |
30 // agents infrastructure are flowing through this communication agent. | 31 // agents infrastructure are flowing through this communication agent. |
31 // There is a corresponding DevToolsClient object on the client side. | 32 // There is a corresponding DevToolsClient object on the client side. |
32 class DevToolsAgent : public RenderViewObserver, | 33 class DevToolsAgent : public RenderFrameObserver, |
33 public base::SupportsWeakPtr<DevToolsAgent>, | 34 public base::SupportsWeakPtr<DevToolsAgent>, |
34 public blink::WebDevToolsAgentClient { | 35 public blink::WebDevToolsAgentClient { |
35 public: | 36 public: |
36 explicit DevToolsAgent(RenderViewImpl* render_view); | 37 explicit DevToolsAgent(RenderFrame* main_render_frame); |
37 ~DevToolsAgent() override; | 38 ~DevToolsAgent() override; |
38 | 39 |
39 // Returns agent instance for its routing id. | 40 // Returns agent instance for its routing id. |
40 static DevToolsAgent* FromRoutingId(int routing_id); | 41 static DevToolsAgent* FromRoutingId(int routing_id); |
41 | 42 |
42 blink::WebDevToolsAgent* GetWebAgent(); | 43 blink::WebDevToolsAgent* GetWebAgent(); |
43 | 44 |
44 bool IsAttached(); | 45 bool IsAttached(); |
45 | 46 |
46 private: | 47 private: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const std::string& agent_state); | 81 const std::string& agent_state); |
81 void OnDetach(); | 82 void OnDetach(); |
82 void OnDispatchOnInspectorBackend(const std::string& message); | 83 void OnDispatchOnInspectorBackend(const std::string& message); |
83 void OnInspectElement(const std::string& host_id, int x, int y); | 84 void OnInspectElement(const std::string& host_id, int x, int y); |
84 void OnAddMessageToConsole(ConsoleMessageLevel level, | 85 void OnAddMessageToConsole(ConsoleMessageLevel level, |
85 const std::string& message); | 86 const std::string& message); |
86 void OnGpuTasksChunk(const std::vector<GpuTaskInfo>& tasks); | 87 void OnGpuTasksChunk(const std::vector<GpuTaskInfo>& tasks); |
87 void ContinueProgram(); | 88 void ContinueProgram(); |
88 void OnSetupDevToolsClient(); | 89 void OnSetupDevToolsClient(); |
89 | 90 |
| 91 RenderViewImpl* GetRenderViewImpl(); |
| 92 |
90 static void TraceEventCallbackWrapper( | 93 static void TraceEventCallbackWrapper( |
91 base::TimeTicks timestamp, | 94 base::TimeTicks timestamp, |
92 char phase, | 95 char phase, |
93 const unsigned char* category_group_enabled, | 96 const unsigned char* category_group_enabled, |
94 const char* name, | 97 const char* name, |
95 unsigned long long id, | 98 unsigned long long id, |
96 int num_args, | 99 int num_args, |
97 const char* const arg_names[], | 100 const char* const arg_names[], |
98 const unsigned char arg_types[], | 101 const unsigned char arg_types[], |
99 const unsigned long long arg_values[], | 102 const unsigned long long arg_values[], |
100 unsigned char flags); | 103 unsigned char flags); |
101 | 104 |
102 bool is_attached_; | 105 bool is_attached_; |
103 bool is_devtools_client_; | 106 bool is_devtools_client_; |
104 int32 gpu_route_id_; | 107 int32 gpu_route_id_; |
105 bool paused_in_mouse_move_; | 108 bool paused_in_mouse_move_; |
| 109 RenderFrame* main_render_frame_; |
106 | 110 |
107 static base::subtle::AtomicWord /* TraceEventCallback */ event_callback_; | 111 static base::subtle::AtomicWord /* TraceEventCallback */ event_callback_; |
108 | 112 |
109 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | 113 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
110 }; | 114 }; |
111 | 115 |
112 } // namespace content | 116 } // namespace content |
113 | 117 |
114 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 118 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
OLD | NEW |