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

Side by Side Diff: content/browser/devtools/devtools_frame_trace_recorder.cc

Issue 1424703003: Kills TraceTicks, which was functionally the same as TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed win compile error. Created 5 years, 1 month 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "content/browser/devtools/devtools_frame_trace_recorder.h" 5 #include "content/browser/devtools/devtools_frame_trace_recorder.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 private: 59 private:
60 ~TraceableDevToolsScreenshot() override { 60 ~TraceableDevToolsScreenshot() override {
61 base::subtle::NoBarrier_AtomicIncrement(&frame_data_count, -1); 61 base::subtle::NoBarrier_AtomicIncrement(&frame_data_count, -1);
62 } 62 }
63 63
64 SkBitmap frame_; 64 SkBitmap frame_;
65 }; 65 };
66 66
67 void FrameCaptured(base::TraceTicks timestamp, const SkBitmap& bitmap, 67 void FrameCaptured(base::TimeTicks timestamp, const SkBitmap& bitmap,
68 ReadbackResponse response) { 68 ReadbackResponse response) {
69 if (response != READBACK_SUCCESS) 69 if (response != READBACK_SUCCESS)
70 return; 70 return;
71 int current_frame_count = base::subtle::NoBarrier_Load(&frame_data_count); 71 int current_frame_count = base::subtle::NoBarrier_Load(&frame_data_count);
72 if (current_frame_count >= kMaximumFrameDataCount) 72 if (current_frame_count >= kMaximumFrameDataCount)
73 return; 73 return;
74 if (bitmap.drawsNothing()) 74 if (bitmap.drawsNothing())
75 return; 75 return;
76 base::subtle::NoBarrier_AtomicIncrement(&frame_data_count, 1); 76 base::subtle::NoBarrier_AtomicIncrement(&frame_data_count, 1);
77 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP( 77 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID_AND_TIMESTAMP(
(...skipping 13 matching lines...) Expand all
91 if (current_frame_count >= kMaximumFrameDataCount) 91 if (current_frame_count >= kMaximumFrameDataCount)
92 return; 92 return;
93 float scale = metadata.page_scale_factor; 93 float scale = metadata.page_scale_factor;
94 float area = metadata.scrollable_viewport_size.GetArea(); 94 float area = metadata.scrollable_viewport_size.GetArea();
95 if (area * scale * scale > kFrameAreaLimit) 95 if (area * scale * scale > kFrameAreaLimit)
96 scale = sqrt(kFrameAreaLimit / area); 96 scale = sqrt(kFrameAreaLimit / area);
97 gfx::Size snapshot_size(gfx::ToRoundedSize(gfx::ScaleSize( 97 gfx::Size snapshot_size(gfx::ToRoundedSize(gfx::ScaleSize(
98 metadata.scrollable_viewport_size, scale))); 98 metadata.scrollable_viewport_size, scale)));
99 view->CopyFromCompositingSurface( 99 view->CopyFromCompositingSurface(
100 gfx::Rect(), snapshot_size, 100 gfx::Rect(), snapshot_size,
101 base::Bind(FrameCaptured, base::TraceTicks::Now()), 101 base::Bind(FrameCaptured, base::TimeTicks::Now()),
102 kN32_SkColorType); 102 kN32_SkColorType);
103 } 103 }
104 104
105 bool ScreenshotCategoryEnabled() { 105 bool ScreenshotCategoryEnabled() {
106 bool enabled; 106 bool enabled;
107 TRACE_EVENT_CATEGORY_GROUP_ENABLED( 107 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
108 TRACE_DISABLED_BY_DEFAULT("devtools.screenshot"), &enabled); 108 TRACE_DISABLED_BY_DEFAULT("devtools.screenshot"), &enabled);
109 return enabled; 109 return enabled;
110 } 110 }
111 111
(...skipping 20 matching lines...) Expand all
132 } 132 }
133 133
134 bool is_new_trace; 134 bool is_new_trace;
135 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); 135 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace);
136 if (!is_new_trace && last_metadata_) 136 if (!is_new_trace && last_metadata_)
137 CaptureFrame(host, *last_metadata_); 137 CaptureFrame(host, *last_metadata_);
138 last_metadata_.reset(new cc::CompositorFrameMetadata(frame_metadata)); 138 last_metadata_.reset(new cc::CompositorFrameMetadata(frame_metadata));
139 } 139 }
140 140
141 } // namespace content 141 } // namespace content
OLDNEW
« no previous file with comments | « components/tracing/tracing_messages.h ('k') | content/browser/tracing/etw_system_event_consumer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698