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

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: 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/threading/thread_checker.h"
14 #include "content/common/gpu/gpu_memory_buffer_factory.h" 14 #include "content/common/gpu/gpu_memory_buffer_factory.h"
15 #include "gpu/command_buffer/service/image_factory.h" 15 #include "gpu/command_buffer/service/image_factory.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/gpu_memory_buffer.h" 17 #include "ui/gfx/gpu_memory_buffer.h"
18 18
19 namespace gfx { 19 namespace gfx {
20 class GLImage; 20 class GLImage;
21 } 21 }
22 22
23 namespace content { 23 namespace content {
(...skipping 28 matching lines...) Expand all
52 const gfx::Size& size, 52 const gfx::Size& size,
53 gfx::GpuMemoryBuffer::Format format, 53 gfx::GpuMemoryBuffer::Format format,
54 unsigned internalformat, 54 unsigned internalformat,
55 int client_id) override; 55 int client_id) override;
56 56
57 private: 57 private:
58 typedef std::pair<int, int> IOSurfaceMapKey; 58 typedef std::pair<int, int> IOSurfaceMapKey;
59 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>> 59 typedef base::hash_map<IOSurfaceMapKey, base::ScopedCFTypeRef<IOSurfaceRef>>
60 IOSurfaceMap; 60 IOSurfaceMap;
61 IOSurfaceMap io_surfaces_; 61 IOSurfaceMap io_surfaces_;
62 base::Lock io_surfaces_lock_; 62 base::ThreadChecker thread_checker_;
63 63
64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface); 64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferFactoryIOSurface);
65 }; 65 };
66 66
67 } // namespace content 67 } // namespace content
68 68
69 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_ 69 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_IO_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698