Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: base/files/file_tracing.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/files/file_tracing.h ('k') | base/files/file_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/files/file_tracing.h"
6
7 #include "base/files/file.h"
8
9 namespace base {
10
11 namespace {
12 FileTracing::Provider* g_provider = nullptr;
13 }
14
15 // static
16 bool FileTracing::IsCategoryEnabled() {
17 return g_provider && g_provider->FileTracingCategoryIsEnabled();
18 }
19
20 // static
21 void FileTracing::SetProvider(FileTracing::Provider* provider) {
22 g_provider = provider;
23 }
24
25 FileTracing::ScopedEnabler::ScopedEnabler() {
26 if (g_provider)
27 g_provider->FileTracingEnable(this);
28 }
29
30 FileTracing::ScopedEnabler::~ScopedEnabler() {
31 if (g_provider)
32 g_provider->FileTracingDisable(this);
33 }
34
35 FileTracing::ScopedTrace::ScopedTrace() : id_(nullptr) {}
36
37 FileTracing::ScopedTrace::~ScopedTrace() {
38 if (id_ && g_provider)
39 g_provider->FileTracingEventEnd(name_, id_);
40 }
41
42 void FileTracing::ScopedTrace::Initialize(
43 const char* name, File* file, int64 size) {
44 id_ = &file->trace_enabler_;
45 name_ = name;
46 g_provider->FileTracingEventBegin(name_, id_, file->tracing_path_, size);
47 }
48
49 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_tracing.h ('k') | base/files/file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698