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

Side by Side Diff: content/common/host_shared_bitmap_manager.h

Issue 1464383004: Add lock around modification of HostSharedBitmapManagerClient::owned_bitmaps_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | content/common/host_shared_bitmap_manager.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_HOST_SHARED_BITMAP_MANAGER_H_ 5 #ifndef CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
6 #define CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ 6 #define CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const cc::SharedBitmapId& id, 44 const cc::SharedBitmapId& id,
45 base::SharedMemoryHandle* shared_memory_handle); 45 base::SharedMemoryHandle* shared_memory_handle);
46 void ChildAllocatedSharedBitmap(size_t buffer_size, 46 void ChildAllocatedSharedBitmap(size_t buffer_size,
47 const base::SharedMemoryHandle& handle, 47 const base::SharedMemoryHandle& handle,
48 base::ProcessHandle process_handle, 48 base::ProcessHandle process_handle,
49 const cc::SharedBitmapId& id); 49 const cc::SharedBitmapId& id);
50 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id); 50 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id);
51 51
52 private: 52 private:
53 HostSharedBitmapManager* manager_; 53 HostSharedBitmapManager* manager_;
54
55 // Lock must be held around access to owned_bitmaps_.
56 base::Lock lock_;
54 base::hash_set<cc::SharedBitmapId> owned_bitmaps_; 57 base::hash_set<cc::SharedBitmapId> owned_bitmaps_;
55 58
56 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManagerClient); 59 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManagerClient);
57 }; 60 };
58 61
59 class CONTENT_EXPORT HostSharedBitmapManager 62 class CONTENT_EXPORT HostSharedBitmapManager
60 : public cc::SharedBitmapManager, 63 : public cc::SharedBitmapManager,
61 public base::trace_event::MemoryDumpProvider { 64 public base::trace_event::MemoryDumpProvider {
62 public: 65 public:
63 HostSharedBitmapManager(); 66 HostSharedBitmapManager();
(...skipping 17 matching lines...) Expand all
81 void FreeSharedMemoryFromMap(const cc::SharedBitmapId& id); 84 void FreeSharedMemoryFromMap(const cc::SharedBitmapId& id);
82 85
83 private: 86 private:
84 friend class HostSharedBitmapManagerClient; 87 friend class HostSharedBitmapManagerClient;
85 88
86 void AllocateSharedBitmapForChild( 89 void AllocateSharedBitmapForChild(
87 base::ProcessHandle process_handle, 90 base::ProcessHandle process_handle,
88 size_t buffer_size, 91 size_t buffer_size,
89 const cc::SharedBitmapId& id, 92 const cc::SharedBitmapId& id,
90 base::SharedMemoryHandle* shared_memory_handle); 93 base::SharedMemoryHandle* shared_memory_handle);
91 void ChildAllocatedSharedBitmap(size_t buffer_size, 94 bool ChildAllocatedSharedBitmap(size_t buffer_size,
92 const base::SharedMemoryHandle& handle, 95 const base::SharedMemoryHandle& handle,
93 base::ProcessHandle process_handle, 96 base::ProcessHandle process_handle,
94 const cc::SharedBitmapId& id); 97 const cc::SharedBitmapId& id);
95 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id); 98 void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id);
96 99
97 mutable base::Lock lock_; 100 mutable base::Lock lock_;
98 101
99 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData> > 102 typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData> >
100 BitmapMap; 103 BitmapMap;
101 BitmapMap handle_map_; 104 BitmapMap handle_map_;
102 105
103 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManager); 106 DISALLOW_COPY_AND_ASSIGN(HostSharedBitmapManager);
104 }; 107 };
105 108
106 } // namespace content 109 } // namespace content
107 110
108 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_ 111 #endif // CONTENT_COMMON_HOST_SHARED_BITMAP_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/host_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698