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

Side by Side Diff: ui/surface/transport_dib.h

Issue 2476113002: Change call-sites now that SkCanvas is not ref-counted (Closed)
Patch Set: try fixing win again Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 UI_SURFACE_TRANSPORT_DIB_H_ 5 #ifndef UI_SURFACE_TRANSPORT_DIB_H_
6 #define UI_SURFACE_TRANSPORT_DIB_H_ 6 #define UI_SURFACE_TRANSPORT_DIB_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "ui/surface/surface_export.h" 14 #include "ui/surface/surface_export.h"
15 15
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include <windows.h> 17 #include <windows.h>
18 #endif 18 #endif
19 19
20 #include <memory>
21
20 class SkCanvas; 22 class SkCanvas;
21 23
22 // ----------------------------------------------------------------------------- 24 // -----------------------------------------------------------------------------
23 // A TransportDIB is a block of memory that is used to transport pixels 25 // A TransportDIB is a block of memory that is used to transport pixels
24 // between processes: from the renderer process to the browser, and 26 // between processes: from the renderer process to the browser, and
25 // between renderer and plugin processes. 27 // between renderer and plugin processes.
26 // ----------------------------------------------------------------------------- 28 // -----------------------------------------------------------------------------
27 class SURFACE_EXPORT TransportDIB { 29 class SURFACE_EXPORT TransportDIB {
28 public: 30 public:
29 ~TransportDIB(); 31 ~TransportDIB();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // pointer will be owned by the caller. The bitmap will be of the given size, 66 // pointer will be owned by the caller. The bitmap will be of the given size,
65 // which should fit inside this memory. Bitmaps returned will be either 67 // which should fit inside this memory. Bitmaps returned will be either
66 // opaque or have premultiplied alpha. 68 // opaque or have premultiplied alpha.
67 // 69 //
68 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, 70 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows,
69 // this |TransportDIB| will NOT be mapped and should not be mapped prior, 71 // this |TransportDIB| will NOT be mapped and should not be mapped prior,
70 // because PlatformCanvas will map the file internally. 72 // because PlatformCanvas will map the file internally.
71 // 73 //
72 // Will return NULL on allocation failure. This could be because the image 74 // Will return NULL on allocation failure. This could be because the image
73 // is too large to map into the current process' address space. 75 // is too large to map into the current process' address space.
74 SkCanvas* GetPlatformCanvas(int w, int h, bool opaque); 76 std::unique_ptr<SkCanvas> GetPlatformCanvas(int w, int h, bool opaque);
75 77
76 // Map the DIB into the current process if it is not already. This is used to 78 // Map the DIB into the current process if it is not already. This is used to
77 // map a DIB that has already been created. Returns true if the DIB is mapped. 79 // map a DIB that has already been created. Returns true if the DIB is mapped.
78 bool Map(); 80 bool Map();
79 81
80 // Return a pointer to the shared memory. 82 // Return a pointer to the shared memory.
81 void* memory() const; 83 void* memory() const;
82 84
83 // Return the maximum size of the shared memory. This is not the amount of 85 // Return the maximum size of the shared memory. This is not the amount of
84 // data which is valid, you have to know that via other means, this is simply 86 // data which is valid, you have to know that via other means, this is simply
(...skipping 11 matching lines...) Expand all
96 98
97 explicit TransportDIB(base::SharedMemoryHandle dib); 99 explicit TransportDIB(base::SharedMemoryHandle dib);
98 base::SharedMemory shared_memory_; 100 base::SharedMemory shared_memory_;
99 uint32_t sequence_num_; 101 uint32_t sequence_num_;
100 size_t size_; // length, in bytes 102 size_t size_; // length, in bytes
101 103
102 DISALLOW_COPY_AND_ASSIGN(TransportDIB); 104 DISALLOW_COPY_AND_ASSIGN(TransportDIB);
103 }; 105 };
104 106
105 #endif // UI_SURFACE_TRANSPORT_DIB_H_ 107 #endif // UI_SURFACE_TRANSPORT_DIB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698