Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/resources/gpu_rasterizer.h" | 5 #include "cc/resources/gpu_rasterizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 canvas->save(); | 184 canvas->save(); |
| 185 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), | 185 tile->raster_source()->PlaybackToCanvas(canvas.get(), tile->content_rect(), |
| 186 tile->contents_scale()); | 186 tile->contents_scale()); |
| 187 canvas->restore(); | 187 canvas->restore(); |
| 188 | 188 |
| 189 // Add the canvas and recorded picture to |multi_picture_draw_|. | 189 // Add the canvas and recorded picture to |multi_picture_draw_|. |
| 190 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); | 190 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
| 191 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); | 191 multi_picture_draw_.add(sk_surface->getCanvas(), picture.get()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void GpuRasterizer::ClearCache() { | |
| 195 ContextProvider* context_provider = | |
| 196 resource_provider()->output_surface()->worker_context_provider(); | |
| 197 | |
| 198 // The context lock must be held while accessing the context on a | |
| 199 // worker thread. | |
| 200 base::AutoLock context_lock(*context_provider->GetLock()); | |
| 201 | |
| 202 // Allow context to bind to current thread. | |
| 203 context_provider->DetachFromThread(); | |
| 204 | |
| 205 // Clear resource cache. | |
| 206 GrContext* gr_context = context_provider->GrContext(); | |
| 207 DCHECK(gr_context); | |
| 208 gr_context->setResourceCacheLimits(0, 0); | |
|
vmiura
2015/03/23 20:34:40
We'll want to not have limits stuck at 0 forever.
sohanjg
2015/03/24 05:42:09
Acknowledged.
Also, should we maintain the limits
vmiura
2015/03/24 06:32:52
Sounds like a good solution.
sohanjg
2015/03/24 13:03:36
Done.
| |
| 209 | |
| 210 // Barrier to sync worker context output to cc context. | |
| 211 context_provider->ContextGL()->OrderingBarrierCHROMIUM(); | |
|
vmiura
2015/03/23 20:34:40
I think it's not necessary to use an ordering barr
sohanjg
2015/03/24 05:42:09
Acknowledged.
And i wonder, ClearCache() will be
vmiura
2015/03/24 06:32:52
Ah, we have to be careful here.
Threaded-GPU mode
sohanjg
2015/03/24 13:03:36
Acknowledged.
| |
| 212 | |
| 213 // Allow context to bind to other threads. | |
| 214 context_provider->DetachFromThread(); | |
| 215 } | |
| 216 | |
| 194 } // namespace cc | 217 } // namespace cc |
| OLD | NEW |