diff options
author | primiano <primiano@chromium.org> | 2016-02-29 12:46:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-29 20:47:30 +0000 |
commit | cb1afb351f2232e22b4be9bbbe7c0449decee471 (patch) | |
tree | 0a6e1671a22625cb1de12949ff3776e055ee3cb5 /components/exo | |
parent | 11ea3850f60af63a8c917d9798bef890f5daa9f2 (diff) | |
download | chromium_src-cb1afb351f2232e22b4be9bbbe7c0449decee471.zip chromium_src-cb1afb351f2232e22b4be9bbbe7c0449decee471.tar.gz chromium_src-cb1afb351f2232e22b4be9bbbe7c0449decee471.tar.bz2 |
tracing: Make ConvertableToTraceFormat move-only
Summary. This CL:
- Makes TraceEvent ownership a move-only scoped_ptr.
- Makes ConvertableToTraceFormat (CTTF) itself move-only scoped_ptr.
- Updates all the codebase that uses CTTF in TRACE_EVENT macros
to use move-only semantics.
Background:
Historically ConvertableToTraceFormat (CTTF) was RefCounted. The main
reason seems to be supporting monitoring mode (now deprecated) where
tracing needed to copy TraceEvents without flushing the TraceLog.
Not what monitoring mode is gone, there is no reason why TraceEvent(s)
should not be move-only.
Unfortunately CTTF being RefCounted exposed that implementation detail
to its public interface. Fortunately, most of the codebase doesn't care
about the fact that CTTF is RefCounted.
The only exceptions are:
1. Memory-infra heap profiler {StackFrame,TypeInfo}Deduplicator
2. cc::Layer DebugInfo
1) Is addressed creating a proxy class which delegates the CTTF methods
to the duplicators inside MDSessionState. Essentially it makes
the CTTF metadata events shared co-owners of the MDSessionState.
2) After an offline chat with danakj@, it seems OK to make DebugInfo(s)
moved scoped_ptr (as opposite as copied), moving the ownership to the
active layer and keeping a raw ptr into the pending layer.
BUG=559117
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
TBR=thakis,jochen,tbarzic,mnaganov,skyostil
Review URL: https://codereview.chromium.org/1717283003
Cr-Commit-Position: refs/heads/master@{#378263}
Diffstat (limited to 'components/exo')
-rw-r--r-- | components/exo/buffer.cc | 6 | ||||
-rw-r--r-- | components/exo/buffer.h | 2 | ||||
-rw-r--r-- | components/exo/shell_surface.cc | 7 | ||||
-rw-r--r-- | components/exo/shell_surface.h | 2 | ||||
-rw-r--r-- | components/exo/sub_surface.cc | 7 | ||||
-rw-r--r-- | components/exo/sub_surface.h | 4 | ||||
-rw-r--r-- | components/exo/surface.cc | 6 | ||||
-rw-r--r-- | components/exo/surface.h | 2 |
8 files changed, 17 insertions, 19 deletions
diff --git a/components/exo/buffer.cc b/components/exo/buffer.cc index de74136..86c04a2 100644 --- a/components/exo/buffer.cc +++ b/components/exo/buffer.cc @@ -453,9 +453,9 @@ gfx::Size Buffer::GetSize() const { return gpu_memory_buffer_->GetSize(); } -scoped_refptr<base::trace_event::TracedValue> Buffer::AsTracedValue() const { - scoped_refptr<base::trace_event::TracedValue> value = - new base::trace_event::TracedValue; +scoped_ptr<base::trace_event::TracedValue> Buffer::AsTracedValue() const { + scoped_ptr<base::trace_event::TracedValue> value( + new base::trace_event::TracedValue()); gfx::Size size = gpu_memory_buffer_->GetSize(); value->SetInteger("width", size.width()); value->SetInteger("height", size.height()); diff --git a/components/exo/buffer.h b/components/exo/buffer.h index a98c4b31..84e744e 100644 --- a/components/exo/buffer.h +++ b/components/exo/buffer.h @@ -63,7 +63,7 @@ class Buffer : public base::SupportsWeakPtr<Buffer> { gfx::Size GetSize() const; // Returns a trace value representing the state of the buffer. - scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; + scoped_ptr<base::trace_event::TracedValue> AsTracedValue() const; private: class Texture; diff --git a/components/exo/shell_surface.cc b/components/exo/shell_surface.cc index 5e2e9eb..6ce2050 100644 --- a/components/exo/shell_surface.cc +++ b/components/exo/shell_surface.cc @@ -229,10 +229,9 @@ Surface* ShellSurface::GetMainSurface(const aura::Window* window) { return window->GetProperty(kMainSurfaceKey); } -scoped_refptr<base::trace_event::TracedValue> ShellSurface::AsTracedValue() - const { - scoped_refptr<base::trace_event::TracedValue> value = - new base::trace_event::TracedValue; +scoped_ptr<base::trace_event::TracedValue> ShellSurface::AsTracedValue() const { + scoped_ptr<base::trace_event::TracedValue> value( + new base::trace_event::TracedValue()); value->SetString("title", base::UTF16ToUTF8(title_)); value->SetString("application_id", application_id_); return value; diff --git a/components/exo/shell_surface.h b/components/exo/shell_surface.h index f1214d6..7f56d7d 100644 --- a/components/exo/shell_surface.h +++ b/components/exo/shell_surface.h @@ -99,7 +99,7 @@ class ShellSurface : public SurfaceDelegate, static Surface* GetMainSurface(const aura::Window* window); // Returns a trace value representing the state of the surface. - scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; + scoped_ptr<base::trace_event::TracedValue> AsTracedValue() const; // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; diff --git a/components/exo/sub_surface.cc b/components/exo/sub_surface.cc index 6cdca07..2357a11 100644 --- a/components/exo/sub_surface.cc +++ b/components/exo/sub_surface.cc @@ -80,10 +80,9 @@ void SubSurface::SetCommitBehavior(bool synchronized) { is_synchronized_ = synchronized; } -scoped_refptr<base::trace_event::TracedValue> SubSurface::AsTracedValue() - const { - scoped_refptr<base::trace_event::TracedValue> value = - new base::trace_event::TracedValue; +scoped_ptr<base::trace_event::TracedValue> SubSurface::AsTracedValue() const { + scoped_ptr<base::trace_event::TracedValue> value( + new base::trace_event::TracedValue()); value->SetBoolean("is_synchronized", is_synchronized_); return value; } diff --git a/components/exo/sub_surface.h b/components/exo/sub_surface.h index a2503a6..a42fcc4 100644 --- a/components/exo/sub_surface.h +++ b/components/exo/sub_surface.h @@ -6,7 +6,7 @@ #define COMPONENTS_EXO_SUB_SURFACE_H_ #include "base/macros.h" -#include "base/memory/ref_counted.h" +#include "base/memory/scoped_ptr.h" #include "components/exo/surface_delegate.h" #include "components/exo/surface_observer.h" #include "ui/gfx/geometry/point.h" @@ -45,7 +45,7 @@ class SubSurface : public SurfaceDelegate, public SurfaceObserver { void SetCommitBehavior(bool synchronized); // Returns a trace value representing the state of the surface. - scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; + scoped_ptr<base::trace_event::TracedValue> AsTracedValue() const; // Overridden from SurfaceDelegate: void OnSurfaceCommit() override; diff --git a/components/exo/surface.cc b/components/exo/surface.cc index f5c3860..23a554a 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc @@ -443,9 +443,9 @@ bool Surface::HasSurfaceObserver(const SurfaceObserver* observer) const { return observers_.HasObserver(observer); } -scoped_refptr<base::trace_event::TracedValue> Surface::AsTracedValue() const { - scoped_refptr<base::trace_event::TracedValue> value = - new base::trace_event::TracedValue; +scoped_ptr<base::trace_event::TracedValue> Surface::AsTracedValue() const { + scoped_ptr<base::trace_event::TracedValue> value( + new base::trace_event::TracedValue()); value->SetString("name", layer()->name()); return value; } diff --git a/components/exo/surface.h b/components/exo/surface.h index ce6ba46..846d12b 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h @@ -123,7 +123,7 @@ class Surface : public aura::Window, bool HasSurfaceObserver(const SurfaceObserver* observer) const; // Returns a trace value representing the state of the surface. - scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const; + scoped_ptr<base::trace_event::TracedValue> AsTracedValue() const; bool HasPendingDamageForTesting(const gfx::Rect& damage) const { return pending_damage_.contains(gfx::RectToSkIRect(damage)); |