summaryrefslogtreecommitdiffstats
path: root/cc/output
diff options
context:
space:
mode:
authorprimiano <primiano@chromium.org>2016-02-29 12:46:05 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-29 20:47:30 +0000
commitcb1afb351f2232e22b4be9bbbe7c0449decee471 (patch)
tree0a6e1671a22625cb1de12949ff3776e055ee3cb5 /cc/output
parent11ea3850f60af63a8c917d9798bef890f5daa9f2 (diff)
downloadchromium_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 'cc/output')
-rw-r--r--cc/output/begin_frame_args.cc8
-rw-r--r--cc/output/begin_frame_args.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/cc/output/begin_frame_args.cc b/cc/output/begin_frame_args.cc
index c50d5f8..98f0a3e 100644
--- a/cc/output/begin_frame_args.cc
+++ b/cc/output/begin_frame_args.cc
@@ -98,12 +98,12 @@ BeginFrameArgs BeginFrameArgs::Create(BeginFrameArgs::CreationLocation location,
#endif
}
-scoped_refptr<base::trace_event::ConvertableToTraceFormat>
+scoped_ptr<base::trace_event::ConvertableToTraceFormat>
BeginFrameArgs::AsValue() const {
- scoped_refptr<base::trace_event::TracedValue> state =
- new base::trace_event::TracedValue();
+ scoped_ptr<base::trace_event::TracedValue> state(
+ new base::trace_event::TracedValue());
AsValueInto(state.get());
- return state;
+ return std::move(state);
}
void BeginFrameArgs::AsValueInto(base::trace_event::TracedValue* state) const {
diff --git a/cc/output/begin_frame_args.h b/cc/output/begin_frame_args.h
index 1f6bc36..6d85b40 100644
--- a/cc/output/begin_frame_args.h
+++ b/cc/output/begin_frame_args.h
@@ -82,7 +82,7 @@ struct CC_EXPORT BeginFrameArgs {
bool IsValid() const { return interval >= base::TimeDelta(); }
- scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
+ scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
void AsValueInto(base::trace_event::TracedValue* dict) const;
void ToProtobuf(proto::BeginFrameArgs* proto) const;