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

Side by Side Diff: cc/output/output_surface.cc

Issue 2349743004: cc: Remove things from OutputSurface and CompositorFrameSink. (Closed)
Patch Set: delete-stuff-cfs: comment-and-rebase Created 4 years, 3 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 | « cc/output/output_surface.h ('k') | cc/output/output_surface_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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 base::trace_event::ProcessMemoryDump* pmd_; 114 base::trace_event::ProcessMemoryDump* pmd_;
115 uint64_t share_group_tracing_guid_; 115 uint64_t share_group_tracing_guid_;
116 116
117 DISALLOW_COPY_AND_ASSIGN(SkiaGpuTraceMemoryDump); 117 DISALLOW_COPY_AND_ASSIGN(SkiaGpuTraceMemoryDump);
118 }; 118 };
119 119
120 } // namespace 120 } // namespace
121 121
122 OutputSurface::OutputSurface( 122 OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
123 scoped_refptr<ContextProvider> context_provider, 123 : context_provider_(std::move(context_provider)), weak_ptr_factory_(this) {
124 scoped_refptr<ContextProvider> worker_context_provider, 124 DCHECK(context_provider_);
125 std::unique_ptr<SoftwareOutputDevice> software_device)
126 : context_provider_(std::move(context_provider)),
127 worker_context_provider_(std::move(worker_context_provider)),
128 software_device_(std::move(software_device)),
129 weak_ptr_factory_(this) {
130 client_thread_checker_.DetachFromThread(); 125 client_thread_checker_.DetachFromThread();
131 } 126 }
132 127
128 OutputSurface::OutputSurface(
129 std::unique_ptr<SoftwareOutputDevice> software_device)
130 : software_device_(std::move(software_device)), weak_ptr_factory_(this) {
131 DCHECK(software_device_);
132 client_thread_checker_.DetachFromThread();
133 }
134
133 OutputSurface::OutputSurface( 135 OutputSurface::OutputSurface(
134 scoped_refptr<VulkanContextProvider> vulkan_context_provider) 136 scoped_refptr<VulkanContextProvider> vulkan_context_provider)
135 : vulkan_context_provider_(vulkan_context_provider), 137 : vulkan_context_provider_(vulkan_context_provider),
136 weak_ptr_factory_(this) { 138 weak_ptr_factory_(this) {
139 DCHECK(vulkan_context_provider_);
137 client_thread_checker_.DetachFromThread(); 140 client_thread_checker_.DetachFromThread();
138 } 141 }
139 142
140 OutputSurface::~OutputSurface() { 143 OutputSurface::~OutputSurface() {
141 if (client_) 144 if (client_)
142 DetachFromClientInternal(); 145 DetachFromClientInternal();
143 } 146 }
144 147
145 bool OutputSurface::HasExternalStencilTest() const { 148 bool OutputSurface::HasExternalStencilTest() const {
146 return false; 149 return false;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool OutputSurface::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 259 bool OutputSurface::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
257 base::trace_event::ProcessMemoryDump* pmd) { 260 base::trace_event::ProcessMemoryDump* pmd) {
258 if (auto* context_provider = this->context_provider()) { 261 if (auto* context_provider = this->context_provider()) {
259 // No need to lock, main context provider is not shared. 262 // No need to lock, main context provider is not shared.
260 if (auto* gr_context = context_provider->GrContext()) { 263 if (auto* gr_context = context_provider->GrContext()) {
261 SkiaGpuTraceMemoryDump trace_memory_dump( 264 SkiaGpuTraceMemoryDump trace_memory_dump(
262 pmd, context_provider->ContextSupport()->ShareGroupTracingGUID()); 265 pmd, context_provider->ContextSupport()->ShareGroupTracingGUID());
263 gr_context->dumpMemoryStatistics(&trace_memory_dump); 266 gr_context->dumpMemoryStatistics(&trace_memory_dump);
264 } 267 }
265 } 268 }
266 if (auto* context_provider = worker_context_provider()) {
267 ContextProvider::ScopedContextLock scoped_context(context_provider);
268
269 if (auto* gr_context = context_provider->GrContext()) {
270 SkiaGpuTraceMemoryDump trace_memory_dump(
271 pmd, context_provider->ContextSupport()->ShareGroupTracingGUID());
272 gr_context->dumpMemoryStatistics(&trace_memory_dump);
273 }
274 }
275
276 return true; 269 return true;
277 } 270 }
278 271
279 void OutputSurface::DetachFromClientInternal() { 272 void OutputSurface::DetachFromClientInternal() {
280 DCHECK(client_thread_checker_.CalledOnValidThread()); 273 DCHECK(client_thread_checker_.CalledOnValidThread());
281 DCHECK(client_); 274 DCHECK(client_);
282 275
283 // Unregister any dump provider. Safe to call (no-op) if we have not yet 276 // Unregister any dump provider. Safe to call (no-op) if we have not yet
284 // registered. 277 // registered.
285 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( 278 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
286 this); 279 this);
287 280
288 if (context_provider_.get()) { 281 if (context_provider_.get()) {
289 context_provider_->SetLostContextCallback( 282 context_provider_->SetLostContextCallback(
290 ContextProvider::LostContextCallback()); 283 ContextProvider::LostContextCallback());
291 } 284 }
292 context_provider_ = nullptr; 285 context_provider_ = nullptr;
293 client_ = nullptr; 286 client_ = nullptr;
294 weak_ptr_factory_.InvalidateWeakPtrs(); 287 weak_ptr_factory_.InvalidateWeakPtrs();
295 } 288 }
296 289
297 void OutputSurface::DidLoseOutputSurface() { 290 void OutputSurface::DidLoseOutputSurface() {
298 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); 291 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface");
299 client_->DidLoseOutputSurface(); 292 client_->DidLoseOutputSurface();
300 } 293 }
301 294
302 } // namespace cc 295 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface.h ('k') | cc/output/output_surface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698