summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/DEPS2
-rw-r--r--content/browser/trace_message_filter.cc2
-rw-r--r--content/common/DEPS2
-rw-r--r--content/common/child_thread.cc4
-rw-r--r--content/components/tracing/DEPS9
-rw-r--r--content/components/tracing/OWNERS2
-rw-r--r--content/components/tracing/child_trace_message_filter.cc117
-rw-r--r--content/components/tracing/child_trace_message_filter.h53
-rw-r--r--content/components/tracing/tracing_messages.cc34
-rw-r--r--content/components/tracing/tracing_messages.h56
-rw-r--r--content/content_common.gypi2
-rw-r--r--content/content_components_tracing.gyp27
-rw-r--r--content/content_components_tracing_untrusted.gyp41
13 files changed, 6 insertions, 345 deletions
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 8a06869..720e4c9 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -1,5 +1,5 @@
include_rules = [
- "+content/components/tracing",
+ "+components/tracing",
"+content/gpu", # For gpu_info_collector.h and in-process GPU
"+content/port/browser",
"+content/public/browser",
diff --git a/content/browser/trace_message_filter.cc b/content/browser/trace_message_filter.cc
index a2586a1..d37ce12 100644
--- a/content/browser/trace_message_filter.cc
+++ b/content/browser/trace_message_filter.cc
@@ -4,8 +4,8 @@
#include "content/browser/trace_message_filter.h"
+#include "components/tracing/tracing_messages.h"
#include "content/browser/trace_controller_impl.h"
-#include "content/components/tracing/tracing_messages.h"
namespace content {
diff --git a/content/common/DEPS b/content/common/DEPS
index 3a97cab..bd4bed3 100644
--- a/content/common/DEPS
+++ b/content/common/DEPS
@@ -1,6 +1,6 @@
include_rules = [
"+cc",
+ "+components/tracing",
"+media/base",
"+sandbox/linux/seccomp-legacy",
- "+content/components/tracing",
]
diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc
index 8b1b000..ea1a665 100644
--- a/content/common/child_thread.cc
+++ b/content/common/child_thread.cc
@@ -11,6 +11,7 @@
#include "base/process_util.h"
#include "base/string_util.h"
#include "base/tracked_objects.h"
+#include "components/tracing/child_trace_message_filter.h"
#include "content/common/child_histogram_message_filter.h"
#include "content/common/child_process.h"
#include "content/common/child_process_messages.h"
@@ -18,7 +19,6 @@
#include "content/common/quota_dispatcher.h"
#include "content/common/resource_dispatcher.h"
#include "content/common/socket_stream_dispatcher.h"
-#include "content/components/tracing/child_trace_message_filter.h"
#include "content/public/common/content_switches.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_switches.h"
@@ -115,7 +115,7 @@ void ChildThread::Init() {
channel_->AddFilter(histogram_message_filter_.get());
channel_->AddFilter(sync_message_filter_.get());
- channel_->AddFilter(new ChildTraceMessageFilter(
+ channel_->AddFilter(new components::ChildTraceMessageFilter(
ChildProcess::current()->io_message_loop_proxy()));
#if defined(OS_POSIX)
diff --git a/content/components/tracing/DEPS b/content/components/tracing/DEPS
deleted file mode 100644
index 7330946..0000000
--- a/content/components/tracing/DEPS
+++ /dev/null
@@ -1,9 +0,0 @@
-include_rules = [
- "+base",
- "+ipc",
-
- # This component will be compiled into NaCl, so it shouldn't depend on
- # anything else in content.
- "-content",
- "+content/components/tracing",
-]
diff --git a/content/components/tracing/OWNERS b/content/components/tracing/OWNERS
deleted file mode 100644
index ba7dc1b..0000000
--- a/content/components/tracing/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-jbauman@chromium.org
-nduca@chromium.org
diff --git a/content/components/tracing/child_trace_message_filter.cc b/content/components/tracing/child_trace_message_filter.cc
deleted file mode 100644
index 453a976..0000000
--- a/content/components/tracing/child_trace_message_filter.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/components/tracing/child_trace_message_filter.h"
-
-#include "base/debug/trace_event.h"
-#include "base/message_loop_proxy.h"
-#include "content/components/tracing/tracing_messages.h"
-
-using base::debug::TraceLog;
-
-namespace content {
-
-ChildTraceMessageFilter::ChildTraceMessageFilter(
- base::MessageLoopProxy* ipc_message_loop)
- : channel_(NULL),
- ipc_message_loop_(ipc_message_loop) {}
-
-void ChildTraceMessageFilter::OnFilterAdded(IPC::Channel* channel) {
- channel_ = channel;
- TraceLog::GetInstance()->SetNotificationCallback(
- base::Bind(&ChildTraceMessageFilter::OnTraceNotification, this));
- channel_->Send(new TracingHostMsg_ChildSupportsTracing());
-}
-
-void ChildTraceMessageFilter::OnFilterRemoved() {
- TraceLog::GetInstance()->SetNotificationCallback(
- TraceLog::NotificationCallback());
-}
-
-bool ChildTraceMessageFilter::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(ChildTraceMessageFilter, message)
- IPC_MESSAGE_HANDLER(TracingMsg_BeginTracing, OnBeginTracing)
- IPC_MESSAGE_HANDLER(TracingMsg_EndTracing, OnEndTracing)
- IPC_MESSAGE_HANDLER(TracingMsg_GetTraceBufferPercentFull,
- OnGetTraceBufferPercentFull)
- IPC_MESSAGE_HANDLER(TracingMsg_SetWatchEvent, OnSetWatchEvent)
- IPC_MESSAGE_HANDLER(TracingMsg_CancelWatchEvent, OnCancelWatchEvent)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-ChildTraceMessageFilter::~ChildTraceMessageFilter() {}
-
-void ChildTraceMessageFilter::OnBeginTracing(
- const std::vector<std::string>& included_categories,
- const std::vector<std::string>& excluded_categories,
- base::TimeTicks browser_time) {
-#if defined(__native_client__)
- // NaCl and system times are offset by a bit, so subtract some time from
- // the captured timestamps. The value might be off by a bit due to messaging
- // latency.
- base::TimeDelta time_offset = base::TimeTicks::NowFromSystemTraceTime() -
- browser_time;
- TraceLog::GetInstance()->SetTimeOffset(time_offset);
-#endif
- TraceLog::GetInstance()->SetEnabled(included_categories,
- excluded_categories);
-}
-
-void ChildTraceMessageFilter::OnEndTracing() {
- TraceLog::GetInstance()->SetDisabled();
-
- // Flush will generate one or more callbacks to OnTraceDataCollected. It's
- // important that the last OnTraceDataCollected gets called before
- // EndTracingAck below. We are already on the IO thread, so the
- // OnTraceDataCollected calls will not be deferred.
- TraceLog::GetInstance()->Flush(
- base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this));
-
- std::vector<std::string> categories;
- TraceLog::GetInstance()->GetKnownCategories(&categories);
- channel_->Send(new TracingHostMsg_EndTracingAck(categories));
-}
-
-void ChildTraceMessageFilter::OnGetTraceBufferPercentFull() {
- float bpf = TraceLog::GetInstance()->GetBufferPercentFull();
-
- channel_->Send(new TracingHostMsg_TraceBufferPercentFullReply(bpf));
-}
-
-void ChildTraceMessageFilter::OnSetWatchEvent(const std::string& category_name,
- const std::string& event_name) {
- TraceLog::GetInstance()->SetWatchEvent(category_name.c_str(),
- event_name.c_str());
-}
-
-void ChildTraceMessageFilter::OnCancelWatchEvent() {
- TraceLog::GetInstance()->CancelWatchEvent();
-}
-
-void ChildTraceMessageFilter::OnTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str_ptr) {
- if (!ipc_message_loop_->BelongsToCurrentThread()) {
- ipc_message_loop_->PostTask(FROM_HERE,
- base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this,
- events_str_ptr));
- return;
- }
- channel_->Send(new TracingHostMsg_TraceDataCollected(
- events_str_ptr->data()));
-}
-
-void ChildTraceMessageFilter::OnTraceNotification(int notification) {
- if (!ipc_message_loop_->BelongsToCurrentThread()) {
- ipc_message_loop_->PostTask(FROM_HERE,
- base::Bind(&ChildTraceMessageFilter::OnTraceNotification, this,
- notification));
- return;
- }
- channel_->Send(new TracingHostMsg_TraceNotification(notification));
-}
-
-} // namespace content
diff --git a/content/components/tracing/child_trace_message_filter.h b/content/components/tracing/child_trace_message_filter.h
deleted file mode 100644
index c6a72e2..0000000
--- a/content/components/tracing/child_trace_message_filter.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_COMPONENTS_TRACING_CHILD_TRACE_MESSAGE_FILTER_H_
-#define CONTENT_COMPONENTS_TRACING_CHILD_TRACE_MESSAGE_FILTER_H_
-
-#include "ipc/ipc_channel_proxy.h"
-
-namespace base {
-class MessageLoopProxy;
-}
-
-namespace content {
-
-// This class sends and receives trace messages on child processes.
-class ChildTraceMessageFilter : public IPC::ChannelProxy::MessageFilter {
- public:
- explicit ChildTraceMessageFilter(base::MessageLoopProxy* ipc_message_loop);
-
- // IPC::ChannelProxy::MessageFilter implementation.
- virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
- virtual void OnFilterRemoved() OVERRIDE;
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
-
- protected:
- virtual ~ChildTraceMessageFilter();
-
- private:
- // Message handlers.
- void OnBeginTracing(const std::vector<std::string>& included_categories,
- const std::vector<std::string>& excluded_categories,
- base::TimeTicks browser_time);
- void OnEndTracing();
- void OnGetTraceBufferPercentFull();
- void OnSetWatchEvent(const std::string& category_name,
- const std::string& event_name);
- void OnCancelWatchEvent();
-
- // Callback from trace subsystem.
- void OnTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str_ptr);
- void OnTraceNotification(int notification);
-
- IPC::Channel* channel_;
- base::MessageLoopProxy* ipc_message_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(ChildTraceMessageFilter);
-};
-
-} // namespace content
-
-#endif // CONTENT_COMPONENTS_TRACING_CHILD_TRACE_MESSAGE_FILTER_H_
diff --git a/content/components/tracing/tracing_messages.cc b/content/components/tracing/tracing_messages.cc
deleted file mode 100644
index df41fad..0000000
--- a/content/components/tracing/tracing_messages.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Get basic type definitions.
-#define IPC_MESSAGE_IMPL
-#include "content/components/tracing/tracing_messages.h"
-
-// Generate constructors.
-#include "ipc/struct_constructor_macros.h"
-#include "content/components/tracing/tracing_messages.h"
-
-// Generate destructors.
-#include "ipc/struct_destructor_macros.h"
-#include "content/components/tracing/tracing_messages.h"
-
-// Generate param traits write methods.
-#include "ipc/param_traits_write_macros.h"
-namespace IPC {
-#include "content/components/tracing/tracing_messages.h"
-} // namespace IPC
-
-// Generate param traits read methods.
-#include "ipc/param_traits_read_macros.h"
-namespace IPC {
-#include "content/components/tracing/tracing_messages.h"
-} // namespace IPC
-
-// Generate param traits log methods.
-#include "ipc/param_traits_log_macros.h"
-namespace IPC {
-#include "content/components/tracing/tracing_messages.h"
-} // namespace IPC
-
diff --git a/content/components/tracing/tracing_messages.h b/content/components/tracing/tracing_messages.h
deleted file mode 100644
index 792c476..0000000
--- a/content/components/tracing/tracing_messages.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Multiply-included message header, no traditional include guard.
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/sync_socket.h"
-#include "ipc/ipc_channel_handle.h"
-#include "ipc/ipc_message_macros.h"
-#include "ipc/ipc_message_utils.h"
-#include "ipc/ipc_platform_file.h"
-
-#define IPC_MESSAGE_START TracingMsgStart
-
-// Sent to all child processes to enable trace event recording.
-IPC_MESSAGE_CONTROL3(TracingMsg_BeginTracing,
- std::vector<std::string> /* included_categories */,
- std::vector<std::string> /* excluded_categories */,
- base::TimeTicks /* browser_time */)
-
-// Sent to all child processes to disable trace event recording.
-IPC_MESSAGE_CONTROL0(TracingMsg_EndTracing)
-
-// Sent to all child processes to get trace buffer fullness.
-IPC_MESSAGE_CONTROL0(TracingMsg_GetTraceBufferPercentFull)
-
-// Sent to all child processes to set watch event.
-IPC_MESSAGE_CONTROL2(TracingMsg_SetWatchEvent,
- std::string /* category_name */,
- std::string /* event_name */)
-
-// Sent to all child processes to clear watch event.
-IPC_MESSAGE_CONTROL0(TracingMsg_CancelWatchEvent)
-
-// Notify the browser that this child process supports tracing.
-IPC_MESSAGE_CONTROL0(TracingHostMsg_ChildSupportsTracing)
-
-// Reply from child processes acking ChildProcessMsg_TraceChangeStatus(false).
-IPC_MESSAGE_CONTROL1(TracingHostMsg_EndTracingAck,
- std::vector<std::string> /* known_categories */)
-
-// Sent if the trace buffer becomes full.
-IPC_MESSAGE_CONTROL1(TracingHostMsg_TraceNotification,
- int /* base::debug::TraceLog::Notification */)
-
-// Child processes send trace data back in JSON chunks.
-IPC_MESSAGE_CONTROL1(TracingHostMsg_TraceDataCollected,
- std::string /*json trace data*/)
-
-// Reply to TracingMsg_GetTraceBufferPercentFull.
-IPC_MESSAGE_CONTROL1(TracingHostMsg_TraceBufferPercentFullReply,
- float /*trace buffer percent full*/)
-
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 5b59060..35aedb1 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -6,13 +6,13 @@
'dependencies': [
'../base/base.gyp:base',
'../build/temp_gyp/googleurl.gyp:googleurl',
+ '../components/components_tracing.gyp:tracing',
'../media/media.gyp:media',
'../net/net.gyp:net',
'../skia/skia.gyp:skia',
'../third_party/icu/icu.gyp:icuuc',
'../ui/ui.gyp:ui',
'../webkit/support/webkit_support.gyp:user_agent',
- 'content_components_tracing.gyp:tracing',
],
'include_dirs': [
'..',
diff --git a/content/content_components_tracing.gyp b/content/content_components_tracing.gyp
deleted file mode 100644
index c9537b1..0000000
--- a/content/content_components_tracing.gyp
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-#
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'targets' : [
- {
- 'target_name': 'tracing',
- 'type': 'static_library',
- 'defines!': ['CONTENT_IMPLEMENTATION'],
- 'dependencies': [
- '../base/base.gyp:base',
- '../ipc/ipc.gyp:ipc',
- ],
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- 'components/tracing/child_trace_message_filter.cc',
- 'components/tracing/child_trace_message_filter.h',
- 'components/tracing/tracing_messages.cc',
- 'components/tracing/tracing_messages.h',
- ],
- },
- ],
-}
diff --git a/content/content_components_tracing_untrusted.gyp b/content/content_components_tracing_untrusted.gyp
deleted file mode 100644
index 701d9f3..0000000
--- a/content/content_components_tracing_untrusted.gyp
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-#
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-{
- 'includes': [
- '../build/common_untrusted.gypi',
- ],
- 'conditions': [
- ['disable_nacl==0 and disable_nacl_untrusted==0', {
- 'targets': [
- {
- 'target_name': 'tracing_untrusted',
- 'type': 'none',
- 'defines!': ['CONTENT_IMPLEMENTATION'],
- 'dependencies': [
- '../base/base_untrusted.gyp:base_untrusted',
- '../native_client/tools.gyp:prep_toolchain',
- '../ipc/ipc.gyp:ipc',
- ],
- 'include_dirs': [
- '..',
- ],
- 'variables': {
- 'nacl_untrusted_build': 1,
- 'nlib_target': 'libtracing_untrusted.a',
- 'build_glibc': 0,
- 'build_newlib': 1,
- },
- 'sources': [
- 'components/tracing/child_trace_message_filter.cc',
- 'components/tracing/child_trace_message_filter.h',
- 'components/tracing/tracing_messages.cc',
- 'components/tracing/tracing_messages.h',
- ],
- },
- ],
- }],
- ],
-}