${includes}
-namespace WebCore {
+namespace blink {
+
+${forward_declarations}
namespace InspectorInstrumentation {
$methods
} // namespace InspectorInstrumentation
-} // namespace WebCore
+} // namespace blink
#endif // !defined(${file_name}_h)
""")
${includes}
-namespace WebCore {
+namespace blink {
${extra_definitions}
namespace InspectorInstrumentation {
} // namespace InspectorInstrumentation
-} // namespace WebCore
+} // namespace blink
""")
template_outofline = string.Template("""
#ifndef InstrumentingAgentsInl_h
#define InstrumentingAgentsInl_h
+#include "platform/heap/Handle.h"
#include "wtf/FastAllocBase.h"
#include "wtf/Noncopyable.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
-namespace WebCore {
+namespace blink {
${forward_list}
-class InstrumentingAgents : public RefCounted<InstrumentingAgents> {
+class InstrumentingAgents : public RefCountedWillBeGarbageCollectedFinalized<InstrumentingAgents> {
WTF_MAKE_NONCOPYABLE(InstrumentingAgents);
- WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
- static PassRefPtr<InstrumentingAgents> create()
+ static PassRefPtrWillBeRawPtr<InstrumentingAgents> create()
{
- return adoptRef(new InstrumentingAgents());
+ return adoptRefWillBeNoop(new InstrumentingAgents());
}
~InstrumentingAgents() { }
+ void trace(Visitor*);
void reset();
${accessor_list}
{
}
+void InstrumentingAgents::trace(Visitor* visitor)
+{
+ $trace_list
+}
+
void InstrumentingAgents::reset()
{
$reset_list
self.name = name
self.header_name = self.name + "Inl"
self.includes = [include_inspector_header("InspectorInstrumentation")]
+ self.forward_declarations = []
self.declarations = []
for line in map(str.strip, source.split("\n")):
line = re.sub("\s{2,}", " ", line).strip() # Collapse whitespace
continue
if line[0] == "#":
self.includes.append(line)
+ elif line.startswith("class "):
+ self.forward_declarations.append(line)
else:
self.declarations.append(Method(line))
self.includes.sort()
+ self.forward_declarations.sort()
def generate(self, cpp_lines, used_agents):
header_lines = []
return template_h.substitute(None,
file_name=self.header_name,
includes="\n".join(self.includes),
+ forward_declarations="\n".join(self.forward_declarations),
methods="\n".join(header_lines))
if self.return_type == "bool":
self.default_return_value = "false"
+ elif self.return_type == "int":
+ self.default_return_value = "0"
elif self.return_type == "String":
self.default_return_value = "\"\""
else:
accessor_list = []
member_list = []
init_list = []
+ trace_list = []
reset_list = []
for agent in agents:
class_name=class_name,
getter_name=getter_name,
member_name=member_name))
- member_list.append(" %s* %s;" % (class_name, member_name))
- init_list.append("%s(0)" % member_name)
- reset_list.append("%s = 0;" % member_name)
+ member_list.append(" RawPtrWillBeMember<%s> %s;" % (class_name, member_name))
+ init_list.append("%s(nullptr)" % member_name)
+ trace_list.append("visitor->trace(%s);" % member_name)
+ reset_list.append("%s = nullptr;" % member_name)
forward_list.sort()
accessor_list.sort()
member_list.sort()
init_list.sort()
+ trace_list.sort()
reset_list.sort()
header_lines = template_instrumenting_agents_h.substitute(
cpp_lines = template_instrumenting_agents_cpp.substitute(
None,
init_list="\n , ".join(init_list),
+ trace_list="\n ".join(trace_list),
reset_list="\n ".join(reset_list))
return header_lines, cpp_lines