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

Side by Side Diff: cc/resources/resource_provider.h

Issue 1951193002: cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_stream
Patch Set: fix gpu Created 4 years, 7 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_ 5 #ifndef CC_RESOURCES_RESOURCE_PROVIDER_H_
6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_ 6 #define CC_RESOURCES_RESOURCE_PROVIDER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 private: 250 private:
251 GLenum unit_; 251 GLenum unit_;
252 GLenum target_; 252 GLenum target_;
253 253
254 DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL); 254 DISALLOW_COPY_AND_ASSIGN(ScopedSamplerGL);
255 }; 255 };
256 256
257 class CC_EXPORT ScopedWriteLockGL { 257 class CC_EXPORT ScopedWriteLockGL {
258 public: 258 public:
259 ScopedWriteLockGL(ResourceProvider* resource_provider, 259 ScopedWriteLockGL(ResourceProvider* resource_provider,
260 ResourceId resource_id); 260 ResourceId resource_id,
261 bool use_mailbox);
261 ~ScopedWriteLockGL(); 262 ~ScopedWriteLockGL();
262 263
263 unsigned texture_id() const { return texture_id_; } 264 unsigned ProduceTextureId();
265 void ReleaseTextureId();
264 266
265 void UpdateResourceSyncToken(const gpu::SyncToken& sync_token) { 267 void UpdateResourceSyncToken(const gpu::SyncToken& sync_token) {
266 set_sync_token_ = true; 268 set_sync_token_ = true;
267 sync_token_ = sync_token; 269 sync_token_ = sync_token;
268 } 270 }
269 271
270 private: 272 private:
271 ResourceProvider* resource_provider_; 273 ResourceProvider* resource_provider_;
272 ResourceProvider::Resource* resource_; 274 ResourceProvider::Resource* resource_;
275 bool use_mailbox_;
273 unsigned texture_id_; 276 unsigned texture_id_;
274 bool set_sync_token_; 277 bool set_sync_token_;
275 gpu::SyncToken sync_token_; 278 gpu::SyncToken sync_token_;
276 279
277 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL); 280 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGL);
278 }; 281 };
279 282
280 class CC_EXPORT ScopedReadLockSoftware { 283 class CC_EXPORT ScopedReadLockSoftware {
281 public: 284 public:
282 ScopedReadLockSoftware(ResourceProvider* resource_provider, 285 ScopedReadLockSoftware(ResourceProvider* resource_provider,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 ResourceProvider::Resource* resource_; 332 ResourceProvider::Resource* resource_;
330 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; 333 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
331 base::ThreadChecker thread_checker_; 334 base::ThreadChecker thread_checker_;
332 335
333 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); 336 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer);
334 }; 337 };
335 338
336 class CC_EXPORT ScopedWriteLockGr { 339 class CC_EXPORT ScopedWriteLockGr {
337 public: 340 public:
338 ScopedWriteLockGr(ResourceProvider* resource_provider, 341 ScopedWriteLockGr(ResourceProvider* resource_provider,
339 ResourceId resource_id); 342 ResourceId resource_id,
343 bool use_mailbox);
340 ~ScopedWriteLockGr(); 344 ~ScopedWriteLockGr();
341 345
342 void InitSkSurface(bool use_distance_field_text, 346 void InitSkSurface(bool use_distance_field_text,
343 bool can_use_lcd_text, 347 bool can_use_lcd_text,
344 int msaa_sample_count); 348 int msaa_sample_count);
345 void ReleaseSkSurface(); 349 void ReleaseSkSurface();
346 350
347 SkSurface* sk_surface() { return sk_surface_.get(); } 351 SkSurface* sk_surface() { return sk_surface_.get(); }
348 352
349 gfx::Size GetResourceSize() const { return resource_->size; } 353 gfx::Size GetResourceSize() const { return resource_->size; }
350 354
351 void UpdateResourceSyncToken(const gpu::SyncToken& sync_token) { 355 void UpdateResourceSyncToken(const gpu::SyncToken& sync_token) {
352 set_sync_token_ = true; 356 set_sync_token_ = true;
353 sync_token_ = sync_token; 357 sync_token_ = sync_token;
354 } 358 }
355 359
356 private: 360 private:
357 ResourceProvider* resource_provider_; 361 ResourceProvider* resource_provider_;
358 ResourceProvider::Resource* resource_; 362 ResourceProvider::Resource* resource_;
363 bool use_mailbox_;
364 unsigned texture_id_;
359 base::ThreadChecker thread_checker_; 365 base::ThreadChecker thread_checker_;
360 sk_sp<SkSurface> sk_surface_; 366 sk_sp<SkSurface> sk_surface_;
361 bool set_sync_token_; 367 bool set_sync_token_;
362 gpu::SyncToken sync_token_; 368 gpu::SyncToken sync_token_;
363 369
364 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); 370 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr);
365 }; 371 };
366 372
367 class Fence : public base::RefCounted<Fence> { 373 class Fence : public base::RefCounted<Fence> {
368 public: 374 public:
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 // A process-unique ID used for disambiguating memory dumps from different 687 // A process-unique ID used for disambiguating memory dumps from different
682 // resource providers. 688 // resource providers.
683 int tracing_id_; 689 int tracing_id_;
684 690
685 DISALLOW_COPY_AND_ASSIGN(ResourceProvider); 691 DISALLOW_COPY_AND_ASSIGN(ResourceProvider);
686 }; 692 };
687 693
688 } // namespace cc 694 } // namespace cc
689 695
690 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 696 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698