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

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

Issue 690713002: cc: check valid thread and resource origin for the resource rasterized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant DCHECK_IS_ON Created 6 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
« no previous file with comments | « no previous file | cc/resources/resource_provider.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 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 <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ~ScopedWriteLockSoftware(); 297 ~ScopedWriteLockSoftware();
298 298
299 SkCanvas* sk_canvas() { return sk_canvas_.get(); } 299 SkCanvas* sk_canvas() { return sk_canvas_.get(); }
300 bool valid() const { return !!sk_bitmap_.getPixels(); } 300 bool valid() const { return !!sk_bitmap_.getPixels(); }
301 301
302 private: 302 private:
303 ResourceProvider* resource_provider_; 303 ResourceProvider* resource_provider_;
304 ResourceProvider::Resource* resource_; 304 ResourceProvider::Resource* resource_;
305 SkBitmap sk_bitmap_; 305 SkBitmap sk_bitmap_;
306 scoped_ptr<SkCanvas> sk_canvas_; 306 scoped_ptr<SkCanvas> sk_canvas_;
307 base::ThreadChecker thread_checker_;
307 308
308 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware); 309 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockSoftware);
309 }; 310 };
310 311
311 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer { 312 class CC_EXPORT ScopedWriteLockGpuMemoryBuffer {
312 public: 313 public:
313 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider, 314 ScopedWriteLockGpuMemoryBuffer(ResourceProvider* resource_provider,
314 ResourceProvider::ResourceId resource_id); 315 ResourceProvider::ResourceId resource_id);
315 ~ScopedWriteLockGpuMemoryBuffer(); 316 ~ScopedWriteLockGpuMemoryBuffer();
316 317
317 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer(); 318 gfx::GpuMemoryBuffer* GetGpuMemoryBuffer();
318 319
319 private: 320 private:
320 ResourceProvider* resource_provider_; 321 ResourceProvider* resource_provider_;
321 ResourceProvider::Resource* resource_; 322 ResourceProvider::Resource* resource_;
322 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 323 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
323 gfx::GpuMemoryBuffer* gpu_memory_buffer_; 324 gfx::GpuMemoryBuffer* gpu_memory_buffer_;
324 gfx::Size size_; 325 gfx::Size size_;
325 ResourceFormat format_; 326 ResourceFormat format_;
327 base::ThreadChecker thread_checker_;
326 328
327 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer); 329 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGpuMemoryBuffer);
328 }; 330 };
329 331
330 class CC_EXPORT ScopedWriteLockGr { 332 class CC_EXPORT ScopedWriteLockGr {
331 public: 333 public:
332 ScopedWriteLockGr(ResourceProvider* resource_provider, 334 ScopedWriteLockGr(ResourceProvider* resource_provider,
333 ResourceProvider::ResourceId resource_id); 335 ResourceProvider::ResourceId resource_id);
334 ~ScopedWriteLockGr(); 336 ~ScopedWriteLockGr();
335 337
336 SkSurface* GetSkSurface(bool use_distance_field_text); 338 SkSurface* GetSkSurface(bool use_distance_field_text);
337 339
338 private: 340 private:
339 ResourceProvider* resource_provider_; 341 ResourceProvider* resource_provider_;
340 ResourceProvider::Resource* resource_; 342 ResourceProvider::Resource* resource_;
343 base::ThreadChecker thread_checker_;
341 344
342 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr); 345 DISALLOW_COPY_AND_ASSIGN(ScopedWriteLockGr);
343 }; 346 };
344 347
345 class Fence : public base::RefCounted<Fence> { 348 class Fence : public base::RefCounted<Fence> {
346 public: 349 public:
347 Fence() {} 350 Fence() {}
348 351
349 virtual void Set() = 0; 352 virtual void Set() = 0;
350 virtual bool HasPassed() = 0; 353 virtual bool HasPassed() = 0;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 return format_gl_data_format[format]; 640 return format_gl_data_format[format];
638 } 641 }
639 642
640 inline GLenum GLInternalFormat(ResourceFormat format) { 643 inline GLenum GLInternalFormat(ResourceFormat format) {
641 return GLDataFormat(format); 644 return GLDataFormat(format);
642 } 645 }
643 646
644 } // namespace cc 647 } // namespace cc
645 648
646 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_ 649 #endif // CC_RESOURCES_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698