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

Side by Side Diff: base/test/test_pending_task.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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/test/test_pending_task.h ('k') | base/test/trace_event_analyzer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/test/test_pending_task.h" 7 #include "base/test/test_pending_task.h"
8 8
9 namespace base { 9 namespace base {
10 10
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const { 29 bool TestPendingTask::ShouldRunBefore(const TestPendingTask& other) const {
30 if (nestability != other.nestability) 30 if (nestability != other.nestability)
31 return (nestability == NESTABLE); 31 return (nestability == NESTABLE);
32 return GetTimeToRun() < other.GetTimeToRun(); 32 return GetTimeToRun() < other.GetTimeToRun();
33 } 33 }
34 34
35 TestPendingTask::~TestPendingTask() {} 35 TestPendingTask::~TestPendingTask() {}
36 36
37 void TestPendingTask::AsValueInto(base::debug::TracedValue* state) const { 37 void TestPendingTask::AsValueInto(base::trace_event::TracedValue* state) const {
38 state->SetInteger("run_at", GetTimeToRun().ToInternalValue()); 38 state->SetInteger("run_at", GetTimeToRun().ToInternalValue());
39 state->SetString("posting_function", location.ToString()); 39 state->SetString("posting_function", location.ToString());
40 state->SetInteger("post_time", post_time.ToInternalValue()); 40 state->SetInteger("post_time", post_time.ToInternalValue());
41 state->SetInteger("delay", delay.ToInternalValue()); 41 state->SetInteger("delay", delay.ToInternalValue());
42 switch (nestability) { 42 switch (nestability) {
43 case NESTABLE: 43 case NESTABLE:
44 state->SetString("nestability", "NESTABLE"); 44 state->SetString("nestability", "NESTABLE");
45 break; 45 break;
46 case NON_NESTABLE: 46 case NON_NESTABLE:
47 state->SetString("nestability", "NON_NESTABLE"); 47 state->SetString("nestability", "NON_NESTABLE");
48 break; 48 break;
49 } 49 }
50 state->SetInteger("delay", delay.ToInternalValue()); 50 state->SetInteger("delay", delay.ToInternalValue());
51 } 51 }
52 52
53 scoped_refptr<base::debug::ConvertableToTraceFormat> TestPendingTask::AsValue() 53 scoped_refptr<base::trace_event::ConvertableToTraceFormat>
54 const { 54 TestPendingTask::AsValue() const {
55 scoped_refptr<base::debug::TracedValue> state = 55 scoped_refptr<base::trace_event::TracedValue> state =
56 new base::debug::TracedValue(); 56 new base::trace_event::TracedValue();
57 AsValueInto(state.get()); 57 AsValueInto(state.get());
58 return state; 58 return state;
59 } 59 }
60 60
61 std::string TestPendingTask::ToString() const { 61 std::string TestPendingTask::ToString() const {
62 std::string output("TestPendingTask("); 62 std::string output("TestPendingTask(");
63 AsValue()->AppendAsTraceFormat(&output); 63 AsValue()->AppendAsTraceFormat(&output);
64 output += ")"; 64 output += ")";
65 return output; 65 return output;
66 } 66 }
67 67
68 std::ostream& operator<<(std::ostream& os, const TestPendingTask& task) { 68 std::ostream& operator<<(std::ostream& os, const TestPendingTask& task) {
69 PrintTo(task, &os); 69 PrintTo(task, &os);
70 return os; 70 return os;
71 } 71 }
72 72
73 void PrintTo(const TestPendingTask& task, std::ostream* os) { 73 void PrintTo(const TestPendingTask& task, std::ostream* os) {
74 *os << task.ToString(); 74 *os << task.ToString();
75 } 75 }
76 76
77 } // namespace base 77 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_pending_task.h ('k') | base/test/trace_event_analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698