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

Side by Side Diff: experimental/flocking_geese/nacl_app/scoped_pixel_lock.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 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
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SCOPED_PIXEL_LOCK_H_
6 #define SCOPED_PIXEL_LOCK_H_
7
8 #include <tr1/memory>
9 #include "nacl_app/locking_image_data.h"
10
11 namespace flocking_geese {
12
13 // A small helper RAII class used to acquire and release the pixel lock based
14 // on C++ scoping rules.
15 class ScopedPixelLock {
16 public:
17 explicit ScopedPixelLock(
18 const std::tr1::shared_ptr<LockingImageData>& pixel_owner)
19 : pixel_owner_(pixel_owner) {
20 pixels_ = pixel_owner_ == NULL ? NULL : pixel_owner->LockPixels();
21 }
22
23 ~ScopedPixelLock() {
24 pixels_ = NULL;
25 if (pixel_owner_ != NULL)
26 pixel_owner_->UnlockPixels();
27 }
28
29 bool is_valid() const {
30 return pixels_ != NULL;
31 }
32
33 uint32_t* pixels() const {
34 return pixels_;
35 }
36
37 private:
38 std::tr1::shared_ptr<LockingImageData> pixel_owner_;
39 uint32_t* pixels_; // Weak reference.
40 };
41 } // namespace flocking_geese
42
43 #endif // SCOPED_PIXEL_LOCK_H_
44
OLDNEW
« no previous file with comments | « experimental/flocking_geese/nacl_app/png_loader.cc ('k') | experimental/flocking_geese/nacl_app/sprite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698