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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_io_surface.h

Issue 1050923003: zero-copy: Clarify to allocate/destroy GpuMemoryBuffer on any thread and use it on the main thread o (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just add thread check Created 5 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
7 7
8 #include <IOSurface/IOSurfaceAPI.h> 8 #include <IOSurface/IOSurfaceAPI.h>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/threading/thread_checker.h"
14 #include "content/common/gpu/gpu_memory_buffer_factory.h" 15 #include "content/common/gpu/gpu_memory_buffer_factory.h"
15 #include "gpu/command_buffer/service/image_factory.h" 16 #include "gpu/command_buffer/service/image_factory.h"
16 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/gpu_memory_buffer.h" 18 #include "ui/gfx/gpu_memory_buffer.h"
18 19
19 namespace gfx { 20 namespace gfx {
20 class GLImage; 21 class GLImage;
21 } 22 }
22 23
23 namespace content { 24 namespace content {
(...skipping 29 matching lines...) Expand all
53 gfx::GpuMemoryBuffer::Format format, 54 gfx::GpuMemoryBuffer::Format format,
54 unsigned internalformat, 55 unsigned internalformat,
55 int client_id) override; 56 int client_id) override;
56 57
57 private: 58 private:
58 typedef std::pair<int, int> IOSurfaceMapKey; 59 typedef std::pair<int, int> IOSurfaceMapKey;
59 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> 60 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>>
60 IOSurfaceMap; 61 IOSurfaceMap;
61 IOSurfaceMap io_surfaces_; 62 IOSurfaceMap io_surfaces_;
62 base::Lock io_surfaces_lock_; 63 base::Lock io_surfaces_lock_;
64 base::ThreadChecker thread_checker_;
63 65
64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); 66 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface);
65 }; 67 };
66 68
67 } // namespace content 69 } // namespace content
68 70
69 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 71 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698