diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-12 22:42:32 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-12 22:42:32 +0000 |
commit | ca8e7b847d359c8841f09f7ea43e2b5cc7dabf13 (patch) | |
tree | 5e73315ac0db059e8976cb07a00814de27d5568c | |
parent | fe327e615bd6ffc0272b4a1cba774c1e1d16c2e6 (diff) | |
download | chromium_src-ca8e7b847d359c8841f09f7ea43e2b5cc7dabf13.zip chromium_src-ca8e7b847d359c8841f09f7ea43e2b5cc7dabf13.tar.gz chromium_src-ca8e7b847d359c8841f09f7ea43e2b5cc7dabf13.tar.bz2 |
Remove all the experimental Traced Task code from remoting.
This code is obsolete and never fully functioned anyways. Deleting.
BUG=57373,65680,73744
TEST=valgrind
Review URL: http://codereview.chromium.org/7780019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100788 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/base/tracer.cc | 192 | ||||
-rw-r--r-- | remoting/base/tracer.h | 252 | ||||
-rw-r--r-- | remoting/client/chromoting_client.cc | 15 | ||||
-rw-r--r-- | remoting/client/chromoting_view.cc | 3 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view.cc | 10 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view_proxy.cc | 17 | ||||
-rw-r--r-- | remoting/client/rectangle_update_decoder.cc | 43 | ||||
-rw-r--r-- | remoting/host/screen_recorder.cc | 43 | ||||
-rw-r--r-- | remoting/host/simple_host_process.cc | 1 | ||||
-rw-r--r-- | remoting/remoting.gyp | 2 | ||||
-rw-r--r-- | tools/valgrind/drmemory/suppressions.txt | 8 | ||||
-rw-r--r-- | tools/valgrind/memcheck/suppressions.txt | 12 |
12 files changed, 45 insertions, 553 deletions
diff --git a/remoting/base/tracer.cc b/remoting/base/tracer.cc deleted file mode 100644 index 677db3a..0000000 --- a/remoting/base/tracer.cc +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) 2011 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 "remoting/base/tracer.h" - -#include <list> - -#include "base/basictypes.h" -#include "base/lazy_instance.h" -#include "base/memory/ref_counted.h" -#include "base/message_loop.h" -#include "base/rand_util.h" -#include "base/stl_util.h" -#include "base/synchronization/condition_variable.h" -#include "base/threading/thread.h" -#include "base/threading/platform_thread.h" -#include "base/threading/thread_local.h" -#include "base/time.h" - -namespace remoting { - -namespace { - -class OutputLogger { - public: - OutputLogger() - : thread_("logging_thread"), - stopped_(false), - wake_(&lock_) { - thread_.Start(); - thread_.message_loop()->PostTask( - FROM_HERE, - NewRunnableMethod(this, &OutputLogger::PrintLogs)); - } - - void OutputTrace(TraceBuffer* buffer) { - scoped_ptr<TraceBuffer> buffer_ref_(buffer); - base::AutoLock l(lock_); - - // Drop messages if we're overwhelming the logger. - if (buffers_.size() < 10) { - buffers_.push_front(buffer_ref_.release()); - wake_.Signal(); - } else { - // TODO(ajwong): Remove this cause it just overwhelms the logging more. - LOG(WARNING) << "Message dropped."; - } - } - - void LogOneTrace(TraceBuffer* buffer) { - VLOG(1) << "Trace: " << buffer->name(); - base::Time last_timestamp; - for (int i = 0; i < buffer->record_size(); ++i) { - const TraceRecord& record = buffer->record(i); - base::Time timestamp = base::Time::FromInternalValue(record.timestamp()); - if (i == 0) { - VLOG(1) << " TS: " << record.timestamp() - << " msg: " << record.annotation(); - } else { - base::TimeDelta delta = timestamp - last_timestamp; - VLOG(1) << " TS: " << record.timestamp() - << " msg: " << record.annotation() - << " [ " << delta.InMilliseconds() << "ms ]"; - } - last_timestamp = timestamp; - } - } - - void PrintLogs() { - while(!stopped_) { - TraceBuffer* buffer = NULL; - { - base::AutoLock l(lock_); - if (buffers_.empty()) { - wake_.Wait(); - } - // Check again since we might have woken for a stop signal. - if (!buffers_.empty()) { - buffer = buffers_.back(); - buffers_.pop_back(); - } - } - - if (buffer) { - LogOneTrace(buffer); - delete buffer; - } - } - } - - private: - friend struct base::DefaultLazyInstanceTraits<OutputLogger>; - - ~OutputLogger() { - { - base::AutoLock l(lock_); - stopped_ = true; - wake_.Signal(); - } - - thread_.Stop(); - STLDeleteElements(&buffers_); - } - - base::Lock lock_; - base::Thread thread_; - bool stopped_; - base::ConditionVariable wake_; - std::list<TraceBuffer*> buffers_; -}; - -static base::LazyInstance<OutputLogger> g_output_logger( - base::LINKER_INITIALIZED); -static base::LazyInstance<base::ThreadLocalPointer<TraceContext> > - g_thread_local_trace_context(base::LINKER_INITIALIZED); - -} // namespace - -Tracer::Tracer(const std::string& name, double sample_percent) { - if (sample_percent > base::RandDouble()) { - buffer_.reset(new TraceBuffer()); - buffer_->set_name(name); - } -} - -void Tracer::PrintString(const std::string& s) { - base::AutoLock l(lock_); - if (!buffer_.get()) { - return; - } - - TraceRecord* record = buffer_->add_record(); - record->set_annotation(s); - record->set_timestamp(base::Time::Now().ToInternalValue()); - - // Take the pointer for the current messageloop as identifying for the - // current thread. - record->set_thread_id(static_cast<uint64>(base::PlatformThread::CurrentId())); -} - -Tracer::~Tracer() { - base::AutoLock l(lock_); - - if (buffer_.get()) { - g_output_logger.Get().OutputTrace(buffer_.release()); - } -} - -// static -Tracer* TraceContext::tracer() { - return Get()->GetTracerInternal(); -} - -// static -void TraceContext::PushTracer(Tracer* tracer) { - Get()->PushTracerInternal(tracer); -} - -// static -void TraceContext::PopTracer() { - Get()->PopTracerInternal(); -} - -// static -TraceContext* TraceContext::Get() { - TraceContext* context = - g_thread_local_trace_context.Get().Get(); - if (context == NULL) { - context = new TraceContext(); - context->PushTracerInternal(new Tracer("default", 0.0)); - g_thread_local_trace_context.Get().Set(context); - } - return context; -} - -TraceContext::TraceContext() {} - -TraceContext::~TraceContext() {} - -void TraceContext::PushTracerInternal(Tracer* tracer) { - tracers_.push_back(make_scoped_refptr(tracer)); -} - -void TraceContext::PopTracerInternal() { tracers_.pop_back(); } - -Tracer* TraceContext::GetTracerInternal() { return tracers_.back(); } - - -} // namespace remoting - -DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::OutputLogger); diff --git a/remoting/base/tracer.h b/remoting/base/tracer.h deleted file mode 100644 index 0fcbdfa..0000000 --- a/remoting/base/tracer.h +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) 2011 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. - -// Tracer objects uresed to record an annotated timeline of events for use in -// gathering performance data. It wraps a TraceBuffer which is the raw data -// for a trace. Tracer is threadsafe. -// -// TraceContext is a singleton that is used to give information for the current -// trace. Clients should query TraceContext to find the current tracer and then -// use that for logging annotations. TraceContext is threadsafe. -// -// ScopedTracer pushes a new Tracer on the TraceContext. It's scoped in that -// this tracer is popped off the context when ScopedTracer goes out of scope. -// However, if a call to NewTracedMethod is made while the ScopedTracer is in -// scope, then a reference to the Tracer will be kept in the resulting Task and -// repushed onto the stack when the Task is run. Conceptually, this simulates -// the current context being continued when the Task is invoked. You usually -// will want to declare a ScopedTracer at the start of a logical flow of -// operations. -// -// Example Usage: -// -// void Decoder::StartDecode() { -// ScopedTracer tracer("decode_start"); -// -// TraceContext::tracer()->PrintString("Decode starting"); -// -// // DoDecode takes 2 parameters. The first is a callback invoked for each -// // finished frame of output. The second is invoked when the task is done. -// DoDecode(NewTracedMethod(this, &Decoder::OnFrameOutput), -// NewTracedMethod(this, &Decoder::DecodeDone)); -// } -// } -// -// void Decoder::OnFrameOutput() { -// TraceContext::tracer()->PrintString("Frame outputed"); -// ... -// } -// -// void Decoder::DecodeDone() { -// TraceContext::tracer()->PrintString("decode done"); -// ... -// } -// -// For each call of StartDecode(), the related calls to OnFrameOutput() and -// DecodeDone() will be annotated to the Tracer created by the ScopedTracer -// declaration allowing for creating of timing information over the related -// asynchronous Task invocations. - -#ifndef REMOTING_BASE_TRACER_H_ -#define REMOTING_BASE_TRACER_H_ - -#include <string> - -#include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/singleton.h" -#include "base/synchronization/lock.h" -#include "base/task.h" -#include "remoting/proto/trace.pb.h" - -namespace remoting { - -class Tracer : public base::RefCountedThreadSafe<Tracer> { - public: - // The |name| is just a label for the given tracer. It is recorder into the - // trace buffer and printed at the end. Use it specify one logical flow such - // as "Host Update Request". The sample_percent is to allow for gathering a - // random sampling of the traces. This allows the tracer to be used in a - // high-frequency code path without spamming the log, or putting undo load on - // the system. Use 0.0 to disable the tracer completely, and 1.0 to log - // everything. - Tracer(const std::string& name, double sample_percent); - - // TODO(ajwong): Consider using an ostream interface similar to DLOG. - void PrintString(const std::string& s); - - void OutputTrace(); - - private: - friend class base::RefCountedThreadSafe<Tracer>; - virtual ~Tracer(); - - base::Lock lock_; - scoped_ptr<TraceBuffer> buffer_; - - DISALLOW_COPY_AND_ASSIGN(Tracer); -}; - -class TraceContext { - public: - // Get the current tracer. - static Tracer* tracer(); - - static void PushTracer(Tracer* tracer); - - static void PopTracer(); - - static TraceContext* Get(); - - private: - TraceContext(); - - ~TraceContext(); - - void PushTracerInternal(Tracer* tracer); - - void PopTracerInternal(); - - Tracer* GetTracerInternal(); - - std::vector<scoped_refptr<Tracer> > tracers_; - - DISALLOW_COPY_AND_ASSIGN(TraceContext); -}; - -// Used to create a new tracer that NewRunnableMethod can propagate from. -// -// Declare this at the logical start of a "trace." Calls to NewTracedMethod -// that are done with the ScopedTracer object is alive will take a reference -// to this tracer. When such a method is invoked, it will push the trace back -// onto the top of the TraceContext stack. The result is that all asynchronous -// tasks that are part of one logical flow will share the same trace. -class ScopedTracer { - public: - ScopedTracer(const std::string& name) { -#if defined(USE_TRACE) - scoped_refptr<Tracer> tracer = new Tracer(name, 1.00); - TraceContext::PushTracer(tracer); -#endif - } - - ~ScopedTracer() { -#if defined(USE_TRACE) - TraceContext::PopTracer(); -#endif - } -}; - -// This is experimental code. I'm creating a set of analogues to -// the NewRunnableMethod functions called NewTracedMethod, which should be -// API equivalent to the former. In fact, they must be enabled by setting -// USE_TRACE 1 for now. -// -// The idea is to add hooks for performance traces into the Task/Callback -// mechanisms. If it works well enough, will think about generalizing into the -// original NewRunnableMethod and NewCallback systems. -#if defined(USE_TRACE) - -template <class T, class Method, class Params> -class TracedMethod : public RunnableMethod<T, Method, Params> { - public: - TracedMethod(T* obj, Method meth, const Params& params) - : RunnableMethod<T, Method, Params>(obj, meth, params), - tracer_(TraceContext::tracer()) { - } - - virtual ~TracedMethod() { - } - - virtual void Run() { - TraceContext::PushTracer(tracer_); - RunnableMethod<T, Method, Params>::Run(); - TraceContext::PopTracer(); - } - - private: - scoped_refptr<Tracer> tracer_; -}; - -template <class T, class Method> -inline CancelableTask* NewTracedMethod(T* object, Method method) { - return new TracedMethod<T, Method, Tuple0>(object, method, MakeTuple()); -} - -template <class T, class Method, class A> -inline CancelableTask* NewTracedMethod(T* object, Method method, const A& a) { - return new TracedMethod<T, Method, Tuple1<A> >(object, - method, - MakeTuple(a)); -} - -template <class T, class Method, class A, class B> -inline CancelableTask* NewTracedMethod(T* object, Method method, - const A& a, const B& b) { - return new TracedMethod<T, Method, Tuple2<A, B> >(object, method, - MakeTuple(a, b)); -} - -template <class T, class Method, class A, class B, class C> -inline CancelableTask* NewTracedMethod(T* object, Method method, - const A& a, const B& b, const C& c) { - return new TracedMethod<T, Method, Tuple3<A, B, C> >(object, method, - MakeTuple(a, b, c)); -} - -template <class T, class Method, class A, class B, class C, class D> -inline CancelableTask* NewTracedMethod(T* object, Method method, - const A& a, const B& b, - const C& c, const D& d) { - return new TracedMethod<T, Method, Tuple4<A, B, C, D> >(object, method, - MakeTuple(a, b, - c, d)); -} - -template <class T, class Method, class A, class B, class C, class D, class E> -inline CancelableTask* NewTracedMethod(T* object, Method method, - const A& a, const B& b, - const C& c, const D& d, const E& e) { - return new TracedMethod<T, - Method, - Tuple5<A, B, C, D, E> >(object, - method, - MakeTuple(a, b, c, d, e)); -} - -template <class T, class Method, class A, class B, class C, class D, class E, - class F> -inline CancelableTask* NewTracedMethod(T* object, Method method, - const A& a, const B& b, - const C& c, const D& d, - const E& e, const F& f) { - return new TracedMethod<T, - Method, - Tuple6<A, B, C, D, E, F> >(object, - method, - MakeTuple(a, b, c, d, e, - f)); -} - -template <class T, class Method, class A, class B, class C, class D, class E, - class F, class G> -inline CancelableTask* NewTracedMethod(T* object, Method method, - const A& a, const B& b, - const C& c, const D& d, const E& e, - const F& f, const G& g) { - return new TracedMethod<T, - Method, - Tuple7<A, B, C, D, E, F, G> >(object, - method, - MakeTuple(a, b, c, d, - e, f, g)); -} - -#else -# define NewTracedMethod NewRunnableMethod -#endif - -} // namespace remoting - -#endif // REMOTING_BASE_TRACER_H_ diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index 350efc1..ae581c8 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "jingle/glue/thread_wrapper.h" -#include "remoting/base/tracer.h" #include "remoting/client/chromoting_view.h" #include "remoting/client/client_context.h" #include "remoting/client/input_handler.h" @@ -152,8 +151,6 @@ void ChromotingClient::DispatchPacket() { const VideoPacket* packet = received_packets_.front().packet; packet_being_processed_ = true; - ScopedTracer tracer("Handle video packet"); - // Measure the latency between the last packet being received and presented. bool last_packet = (packet->flags() & VideoPacket::LAST_PACKET) != 0; base::Time decode_start; @@ -161,8 +158,8 @@ void ChromotingClient::DispatchPacket() { decode_start = base::Time::Now(); rectangle_decoder_->DecodePacket( - packet, NewTracedMethod(this, &ChromotingClient::OnPacketDone, - last_packet, decode_start)); + packet, NewRunnableMethod(this, &ChromotingClient::OnPacketDone, + last_packet, decode_start)); } void ChromotingClient::OnConnectionOpened(protocol::ConnectionToHost* conn) { @@ -204,13 +201,11 @@ void ChromotingClient::OnPacketDone(bool last_packet, if (!message_loop()->BelongsToCurrentThread()) { message_loop()->PostTask( FROM_HERE, - NewTracedMethod(this, &ChromotingClient::OnPacketDone, + NewRunnableMethod(this, &ChromotingClient::OnPacketDone, last_packet, decode_start)); return; } - TraceContext::tracer()->PrintString("Packet done"); - // Record the latency between the final packet being received and // presented. if (last_packet) { @@ -232,12 +227,10 @@ void ChromotingClient::Initialize() { if (!message_loop()->BelongsToCurrentThread()) { message_loop()->PostTask( FROM_HERE, - NewTracedMethod(this, &ChromotingClient::Initialize)); + NewRunnableMethod(this, &ChromotingClient::Initialize)); return; } - TraceContext::tracer()->PrintString("Initializing client."); - // Initialize the decoder. rectangle_decoder_->Initialize(connection_->config()); diff --git a/remoting/client/chromoting_view.cc b/remoting/client/chromoting_view.cc index e8b5f0f..23138d0 100644 --- a/remoting/client/chromoting_view.cc +++ b/remoting/client/chromoting_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,7 +6,6 @@ #include "base/message_loop.h" #include "base/synchronization/waitable_event.h" -#include "remoting/base/tracer.h" namespace remoting { diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc index b227402..8d5525f 100644 --- a/remoting/client/plugin/pepper_view.cc +++ b/remoting/client/plugin/pepper_view.cc @@ -11,7 +11,6 @@ #include "ppapi/cpp/point.h" #include "ppapi/cpp/rect.h" #include "ppapi/cpp/size.h" -#include "remoting/base/tracer.h" #include "remoting/base/util.h" #include "remoting/client/chromoting_stats.h" #include "remoting/client/client_context.h" @@ -45,8 +44,6 @@ void PepperView::TearDown() { void PepperView::Paint() { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); - TraceContext::tracer()->PrintString("Start Paint."); - if (is_static_fill_) { LOG(INFO) << "Static filling " << static_fill_color_; pp::ImageData image(instance_, pp::ImageData::GetNativeImageDataFormat(), @@ -75,7 +72,6 @@ void PepperView::Paint() { // that has the data here which can be redrawn. return; } - TraceContext::tracer()->PrintString("End Paint."); } void PepperView::SetHostSize(const gfx::Size& host_size) { @@ -94,8 +90,6 @@ void PepperView::SetHostSize(const gfx::Size& host_size) { void PepperView::PaintFrame(media::VideoFrame* frame, UpdatedRects* rects) { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); - TraceContext::tracer()->PrintString("Start Paint Frame."); - SetHostSize(gfx::Size(frame->width(), frame->height())); if (!backing_store_.get() || backing_store_->is_null()) { @@ -112,8 +106,6 @@ void PepperView::PaintFrame(media::VideoFrame* frame, UpdatedRects* rects) { if (changes_made) FlushGraphics(start_time); - - TraceContext::tracer()->PrintString("End Paint Frame."); } bool PepperView::PaintRect(media::VideoFrame* frame, const gfx::Rect& r) { @@ -325,7 +317,6 @@ void PepperView::OnPartialFrameOutput(media::VideoFrame* frame, Task* done) { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); - TraceContext::tracer()->PrintString("Calling PaintFrame"); // TODO(ajwong): Clean up this API to be async so we don't need to use a // member variable as a hack. PaintFrame(frame, rects); @@ -335,7 +326,6 @@ void PepperView::OnPartialFrameOutput(media::VideoFrame* frame, void PepperView::OnPaintDone(base::Time paint_start) { DCHECK(context_->main_message_loop()->BelongsToCurrentThread()); - TraceContext::tracer()->PrintString("Paint flushed"); instance_->GetStats()->video_paint_ms()->Record( (base::Time::Now() - paint_start).InMilliseconds()); diff --git a/remoting/client/plugin/pepper_view_proxy.cc b/remoting/client/plugin/pepper_view_proxy.cc index 6599f3c..3e4bb35 100644 --- a/remoting/client/plugin/pepper_view_proxy.cc +++ b/remoting/client/plugin/pepper_view_proxy.cc @@ -5,7 +5,6 @@ #include "remoting/client/plugin/pepper_view_proxy.h" #include "base/message_loop.h" -#include "remoting/base/tracer.h" #include "remoting/client/client_context.h" #include "remoting/client/plugin/chromoting_instance.h" @@ -31,7 +30,7 @@ bool PepperViewProxy::Initialize() { void PepperViewProxy::TearDown() { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { plugin_message_loop_->PostTask( - FROM_HERE, NewTracedMethod(this, &PepperViewProxy::TearDown)); + FROM_HERE, NewRunnableMethod(this, &PepperViewProxy::TearDown)); return; } @@ -42,7 +41,7 @@ void PepperViewProxy::TearDown() { void PepperViewProxy::Paint() { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { plugin_message_loop_->PostTask( - FROM_HERE, NewTracedMethod(this, &PepperViewProxy::Paint)); + FROM_HERE, NewRunnableMethod(this, &PepperViewProxy::Paint)); return; } @@ -52,7 +51,7 @@ void PepperViewProxy::Paint() { void PepperViewProxy::SetSolidFill(uint32 color) { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { - plugin_message_loop_->PostTask(FROM_HERE, NewTracedMethod( + plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &PepperViewProxy::SetSolidFill, color)); return; } @@ -64,7 +63,7 @@ void PepperViewProxy::SetSolidFill(uint32 color) { void PepperViewProxy::UnsetSolidFill() { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { plugin_message_loop_->PostTask( - FROM_HERE, NewTracedMethod(this, &PepperViewProxy::UnsetSolidFill)); + FROM_HERE, NewRunnableMethod(this, &PepperViewProxy::UnsetSolidFill)); return; } @@ -85,7 +84,7 @@ void PepperViewProxy::SetConnectionState(ConnectionState state) { void PepperViewProxy::UpdateLoginStatus(bool success, const std::string& info) { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { - plugin_message_loop_->PostTask(FROM_HERE, NewTracedMethod( + plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &PepperViewProxy::UpdateLoginStatus, success, info)); return; } @@ -123,7 +122,7 @@ void PepperViewProxy::AllocateFrame( scoped_refptr<media::VideoFrame>* frame_out, Task* done) { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { - plugin_message_loop_->PostTask(FROM_HERE, NewTracedMethod( + plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &PepperViewProxy::AllocateFrame, format, width, height, timestamp, duration, frame_out, done)); return; @@ -137,7 +136,7 @@ void PepperViewProxy::AllocateFrame( void PepperViewProxy::ReleaseFrame(media::VideoFrame* frame) { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { - plugin_message_loop_->PostTask(FROM_HERE, NewTracedMethod( + plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &PepperViewProxy::ReleaseFrame, make_scoped_refptr(frame))); return; } @@ -150,7 +149,7 @@ void PepperViewProxy::OnPartialFrameOutput(media::VideoFrame* frame, UpdatedRects* rects, Task* done) { if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) { - plugin_message_loop_->PostTask(FROM_HERE, NewTracedMethod( + plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &PepperViewProxy::OnPartialFrameOutput, make_scoped_refptr(frame), rects, done)); return; diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc index c6426a8..b96b7ba 100644 --- a/remoting/client/rectangle_update_decoder.cc +++ b/remoting/client/rectangle_update_decoder.cc @@ -9,7 +9,6 @@ #include "remoting/base/decoder.h" #include "remoting/base/decoder_row_based.h" #include "remoting/base/decoder_vp8.h" -#include "remoting/base/tracer.h" #include "remoting/base/util.h" #include "remoting/client/frame_consumer.h" #include "remoting/protocol/session_config.h" @@ -59,13 +58,10 @@ void RectangleUpdateDecoder::Initialize(const SessionConfig& config) { // Initialize decoder based on the selected codec. ChannelConfig::Codec codec = config.video_config().codec; if (codec == ChannelConfig::CODEC_VERBATIM) { - TraceContext::tracer()->PrintString("Creating Verbatim decoder."); decoder_.reset(DecoderRowBased::CreateVerbatimDecoder()); } else if (codec == ChannelConfig::CODEC_ZIP) { - TraceContext::tracer()->PrintString("Creating Zlib decoder"); decoder_.reset(DecoderRowBased::CreateZlibDecoder()); } else if (codec == ChannelConfig::CODEC_VP8) { - TraceContext::tracer()->PrintString("Creating VP8 decoder"); decoder_.reset(new DecoderVp8()); } else { NOTREACHED() << "Invalid Encoding found: " << codec; @@ -77,15 +73,13 @@ void RectangleUpdateDecoder::DecodePacket(const VideoPacket* packet, if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, - &RectangleUpdateDecoder::DecodePacket, packet, - done)); + NewRunnableMethod(this, + &RectangleUpdateDecoder::DecodePacket, packet, + done)); return; } base::ScopedTaskRunner done_runner(done); - TraceContext::tracer()->PrintString("Decode Packet called."); - AllocateFrame(packet, done_runner.Release()); } @@ -94,14 +88,13 @@ void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet, if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, - &RectangleUpdateDecoder::AllocateFrame, packet, done)); + NewRunnableMethod( + this, + &RectangleUpdateDecoder::AllocateFrame, packet, done)); return; } base::ScopedTaskRunner done_runner(done); - TraceContext::tracer()->PrintString("AllocateFrame called."); - // Find the required frame size. bool has_screen_size = packet->format().has_screen_width() && packet->format().has_screen_height(); @@ -119,11 +112,9 @@ void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet, // Allocate a new frame, if necessary. if ((!frame_) || (has_screen_size && (screen_size != frame_size))) { if (frame_) { - TraceContext::tracer()->PrintString("Releasing old frame."); consumer_->ReleaseFrame(frame_); frame_ = NULL; } - TraceContext::tracer()->PrintString("Requesting new frame."); consumer_->AllocateFrame(media::VideoFrame::RGB32, screen_size.width(), screen_size.height(), @@ -143,9 +134,9 @@ void RectangleUpdateDecoder::ProcessPacketData( if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, - &RectangleUpdateDecoder::ProcessPacketData, packet, - done)); + NewRunnableMethod(this, + &RectangleUpdateDecoder::ProcessPacketData, packet, + done)); return; } base::ScopedTaskRunner done_runner(done); @@ -162,8 +153,6 @@ void RectangleUpdateDecoder::ProcessPacketData( return; } - TraceContext::tracer()->PrintString("Executing Decode."); - if (decoder_->DecodePacket(packet) == Decoder::DECODE_DONE) SubmitToConsumer(); } @@ -173,10 +162,10 @@ void RectangleUpdateDecoder::SetScaleRatios(double horizontal_ratio, if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, - &RectangleUpdateDecoder::SetScaleRatios, - horizontal_ratio, - vertical_ratio)); + NewRunnableMethod(this, + &RectangleUpdateDecoder::SetScaleRatios, + horizontal_ratio, + vertical_ratio)); return; } @@ -190,7 +179,7 @@ void RectangleUpdateDecoder::UpdateClipRect(const gfx::Rect& new_clip_rect) { if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod( + NewRunnableMethod( this, &RectangleUpdateDecoder::UpdateClipRect, new_clip_rect)); return; @@ -241,7 +230,7 @@ void RectangleUpdateDecoder::RefreshFullFrame() { if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &RectangleUpdateDecoder::RefreshFullFrame)); + NewRunnableMethod(this, &RectangleUpdateDecoder::RefreshFullFrame)); return; } @@ -286,7 +275,7 @@ void RectangleUpdateDecoder::OnFrameConsumed() { if (message_loop_ != MessageLoop::current()) { message_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &RectangleUpdateDecoder::OnFrameConsumed)); + NewRunnableMethod(this, &RectangleUpdateDecoder::OnFrameConsumed)); return; } diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc index e0cf90a..cca7c37 100644 --- a/remoting/host/screen_recorder.cc +++ b/remoting/host/screen_recorder.cc @@ -14,7 +14,6 @@ #include "base/task.h" #include "base/time.h" #include "remoting/base/capture_data.h" -#include "remoting/base/tracer.h" #include "remoting/proto/control.pb.h" #include "remoting/proto/video.pb.h" #include "remoting/protocol/client_stub.h" @@ -66,7 +65,7 @@ ScreenRecorder::~ScreenRecorder() { void ScreenRecorder::Start() { capture_loop_->PostTask( - FROM_HERE, NewTracedMethod(this, &ScreenRecorder::DoStart)); + FROM_HERE, NewRunnableMethod(this, &ScreenRecorder::DoStart)); } void ScreenRecorder::Stop(const base::Closure& done_task) { @@ -87,13 +86,11 @@ void ScreenRecorder::Stop(const base::Closure& done_task) { void ScreenRecorder::SetMaxRate(double rate) { capture_loop_->PostTask( - FROM_HERE, NewTracedMethod(this, &ScreenRecorder::DoSetMaxRate, rate)); + FROM_HERE, NewRunnableMethod(this, &ScreenRecorder::DoSetMaxRate, rate)); } void ScreenRecorder::AddConnection( scoped_refptr<ConnectionToClient> connection) { - ScopedTracer tracer("AddConnection"); - capture_loop_->PostTask( FROM_HERE, NewRunnableMethod(this, &ScreenRecorder::DoInvalidateFullScreen)); @@ -101,20 +98,20 @@ void ScreenRecorder::AddConnection( // Add the client to the list so it can receive update stream. network_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &ScreenRecorder::DoAddConnection, connection)); + NewRunnableMethod(this, &ScreenRecorder::DoAddConnection, connection)); } void ScreenRecorder::RemoveConnection( scoped_refptr<ConnectionToClient> connection) { network_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &ScreenRecorder::DoRemoveClient, connection)); + NewRunnableMethod(this, &ScreenRecorder::DoRemoveClient, connection)); } void ScreenRecorder::RemoveAllConnections() { network_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &ScreenRecorder::DoRemoveAllClients)); + NewRunnableMethod(this, &ScreenRecorder::DoRemoveAllClients)); } void ScreenRecorder::UpdateSequenceNumber(int64 sequence_number) { @@ -199,8 +196,6 @@ void ScreenRecorder::DoCapture() { capture_timer_.Reset(); } - TraceContext::tracer()->PrintString("Capture Started"); - // At this point we are going to perform one capture so save the current time. ++recordings_; DCHECK_LE(recordings_, kMaxRecordings); @@ -218,7 +213,6 @@ void ScreenRecorder::CaptureDoneCallback( if (!is_recording_) return; - TraceContext::tracer()->PrintString("Capture Done"); if (capture_data) { int capture_time = static_cast<int>( (base::Time::Now() - capture_start_time_).InMilliseconds()); @@ -234,7 +228,7 @@ void ScreenRecorder::CaptureDoneCallback( encode_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &ScreenRecorder::DoEncode, capture_data)); + NewRunnableMethod(this, &ScreenRecorder::DoEncode, capture_data)); } void ScreenRecorder::DoFinishOneRecording() { @@ -265,8 +259,6 @@ void ScreenRecorder::DoInvalidateFullScreen() { void ScreenRecorder::DoSendVideoPacket(VideoPacket* packet) { DCHECK(network_loop_->BelongsToCurrentThread()); - TraceContext::tracer()->PrintString("DoSendVideoPacket"); - bool last = (packet->flags() & VideoPacket::LAST_PARTITION) != 0; if (network_stopped_ || connections_.empty()) { @@ -281,8 +273,8 @@ void ScreenRecorder::DoSendVideoPacket(VideoPacket* packet) { // Call FrameSentCallback() only for the last packet in the first // connection. if (last && i == connections_.begin()) { - done_task = NewTracedMethod(this, &ScreenRecorder::FrameSentCallback, - packet); + done_task = NewRunnableMethod(this, &ScreenRecorder::FrameSentCallback, + packet); } else { // TODO(hclam): Fix this code since it causes multiple deletion if there's // more than one connection. @@ -291,8 +283,6 @@ void ScreenRecorder::DoSendVideoPacket(VideoPacket* packet) { (*i)->video_stub()->ProcessVideoPacket(packet, done_task); } - - TraceContext::tracer()->PrintString("DoSendVideoPacket done"); } void ScreenRecorder::FrameSentCallback(VideoPacket* packet) { @@ -302,7 +292,8 @@ void ScreenRecorder::FrameSentCallback(VideoPacket* packet) { return; capture_loop_->PostTask( - FROM_HERE, NewTracedMethod(this, &ScreenRecorder::DoFinishOneRecording)); + FROM_HERE, NewRunnableMethod(this, + &ScreenRecorder::DoFinishOneRecording)); } void ScreenRecorder::DoAddConnection( @@ -343,7 +334,8 @@ void ScreenRecorder::DoStopOnNetworkThread(const base::Closure& done_task) { encode_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &ScreenRecorder::DoStopOnEncodeThread, done_task)); + NewRunnableMethod(this, &ScreenRecorder::DoStopOnEncodeThread, + done_task)); } // Encoder thread -------------------------------------------------------------- @@ -351,7 +343,6 @@ void ScreenRecorder::DoStopOnNetworkThread(const base::Closure& done_task) { void ScreenRecorder::DoEncode( scoped_refptr<CaptureData> capture_data) { DCHECK_EQ(encode_loop_, MessageLoop::current()); - TraceContext::tracer()->PrintString("DoEncode called"); // Early out if there's nothing to encode. if (!capture_data || capture_data->dirty_region().isEmpty()) { @@ -360,18 +351,16 @@ void ScreenRecorder::DoEncode( packet->set_flags(VideoPacket::LAST_PARTITION); network_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, - &ScreenRecorder::DoSendVideoPacket, - packet)); + NewRunnableMethod(this, + &ScreenRecorder::DoSendVideoPacket, + packet)); return; } - TraceContext::tracer()->PrintString("Encode start"); encode_start_time_ = base::Time::Now(); encoder()->Encode( capture_data, false, NewCallback(this, &ScreenRecorder::EncodedDataAvailableCallback)); - TraceContext::tracer()->PrintString("Encode Done"); } void ScreenRecorder::DoStopOnEncodeThread(const base::Closure& done_task) { @@ -400,7 +389,7 @@ void ScreenRecorder::EncodedDataAvailableCallback(VideoPacket* packet) { network_loop_->PostTask( FROM_HERE, - NewTracedMethod(this, &ScreenRecorder::DoSendVideoPacket, packet)); + NewRunnableMethod(this, &ScreenRecorder::DoSendVideoPacket, packet)); } } // namespace remoting diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index 336bac5..c527b24 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -33,7 +33,6 @@ #include "base/threading/thread.h" #include "crypto/nss_util.h" #include "remoting/base/constants.h" -#include "remoting/base/tracer.h" #include "remoting/host/capturer_fake.h" #include "remoting/host/chromoting_host.h" #include "remoting/host/chromoting_host_context.h" diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 63f4f557..01c4d39 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -412,8 +412,6 @@ 'base/running_average.h', 'base/task_thread_proxy.cc', 'base/task_thread_proxy.h', - 'base/tracer.cc', - 'base/tracer.h', 'base/util.cc', 'base/util.h', ], diff --git a/tools/valgrind/drmemory/suppressions.txt b/tools/valgrind/drmemory/suppressions.txt index 2c9584a..b57bd44 100644 --- a/tools/valgrind/drmemory/suppressions.txt +++ b/tools/valgrind/drmemory/suppressions.txt @@ -782,14 +782,6 @@ LEAK *!net::SSL*SocketNSS::DoHandshake *!net::SSL*SocketNSS::DoHandshakeLoop -# http://crbug.com/73744 -LEAK -*!operator new -*!remoting::TraceContext::Get -*!remoting::TraceContext::tracer -*!remoting::ScreenRecorder::DoCapture -*!remoting::ScreenRecorder::DoStart - # http://crbug.com/74413 LEAK ... diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index bbb9bb7..ecc8ef4 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -3331,18 +3331,6 @@ fun:*DownloadFileTest5SetUpEv } { - bug_65680 - Memcheck:Leak - fun:_Znw* - fun:_ZN8remoting12TraceContext3GetEv - fun:_ZN8remoting12TraceContext6tracerEv - fun:_ZN8remoting14ScreenRecorder9DoCaptureEv - fun:_ZN8remoting14ScreenRecorder7DoStartEv - fun:_Z16DispatchToMethodIN8remoting14ScreenRecorderEMS1_FvvEEvPT_T0_RK6Tuple0 - fun:_ZN14RunnableMethodIN8remoting14ScreenRecorderEMS1_FvvE6Tuple0E3RunEv - fun:*18TaskClosureAdapter3RunEv -} -{ bug_72544 Memcheck:Leak fun:malloc |