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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 3 years, 12 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
« no previous file with comments | « ui/native_theme/native_theme_win.cc ('k') | ui/surface/transport_dib_posix.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) 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 "skia/ext/cdl_common.h"
14 #include "ui/surface/surface_export.h" 15 #include "ui/surface/surface_export.h"
15 16
16 #if defined(OS_WIN) 17 #if defined(OS_WIN)
17 #include <windows.h> 18 #include <windows.h>
18 #endif 19 #endif
19 20
20 #include <memory> 21 #include <memory>
21 22
22 class SkCanvas;
23
24 // ----------------------------------------------------------------------------- 23 // -----------------------------------------------------------------------------
25 // A TransportDIB is a block of memory that is used to transport pixels 24 // A TransportDIB is a block of memory that is used to transport pixels
26 // between processes: from the renderer process to the browser, and 25 // between processes: from the renderer process to the browser, and
27 // between renderer and plugin processes. 26 // between renderer and plugin processes.
28 // ----------------------------------------------------------------------------- 27 // -----------------------------------------------------------------------------
29 class SURFACE_EXPORT TransportDIB { 28 class SURFACE_EXPORT TransportDIB {
30 public: 29 public:
31 ~TransportDIB(); 30 ~TransportDIB();
32 31
33 // A Handle is the type which can be sent over the wire so that the remote 32 // A Handle is the type which can be sent over the wire so that the remote
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // pointer will be owned by the caller. The bitmap will be of the given size, 65 // pointer will be owned by the caller. The bitmap will be of the given size,
67 // which should fit inside this memory. Bitmaps returned will be either 66 // which should fit inside this memory. Bitmaps returned will be either
68 // opaque or have premultiplied alpha. 67 // opaque or have premultiplied alpha.
69 // 68 //
70 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows, 69 // On POSIX, this |TransportDIB| will be mapped if not already. On Windows,
71 // this |TransportDIB| will NOT be mapped and should not be mapped prior, 70 // this |TransportDIB| will NOT be mapped and should not be mapped prior,
72 // because PlatformCanvas will map the file internally. 71 // because PlatformCanvas will map the file internally.
73 // 72 //
74 // Will return NULL on allocation failure. This could be because the image 73 // Will return NULL on allocation failure. This could be because the image
75 // is too large to map into the current process' address space. 74 // is too large to map into the current process' address space.
76 std::unique_ptr<SkCanvas> GetPlatformCanvas(int w, int h, bool opaque); 75 std::unique_ptr<CdlCanvas> GetPlatformCanvas(int w, int h, bool opaque);
77 76
78 // Map the DIB into the current process if it is not already. This is used to 77 // Map the DIB into the current process if it is not already. This is used to
79 // map a DIB that has already been created. Returns true if the DIB is mapped. 78 // map a DIB that has already been created. Returns true if the DIB is mapped.
80 bool Map(); 79 bool Map();
81 80
82 // Return a pointer to the shared memory. 81 // Return a pointer to the shared memory.
83 void* memory() const; 82 void* memory() const;
84 83
85 // Return the maximum size of the shared memory. This is not the amount of 84 // Return the maximum size of the shared memory. This is not the amount of
86 // data which is valid, you have to know that via other means, this is simply 85 // data which is valid, you have to know that via other means, this is simply
(...skipping 11 matching lines...) Expand all
98 97
99 explicit TransportDIB(base::SharedMemoryHandle dib); 98 explicit TransportDIB(base::SharedMemoryHandle dib);
100 base::SharedMemory shared_memory_; 99 base::SharedMemory shared_memory_;
101 uint32_t sequence_num_; 100 uint32_t sequence_num_;
102 size_t size_; // length, in bytes 101 size_t size_; // length, in bytes
103 102
104 DISALLOW_COPY_AND_ASSIGN(TransportDIB); 103 DISALLOW_COPY_AND_ASSIGN(TransportDIB);
105 }; 104 };
106 105
107 #endif // UI_SURFACE_TRANSPORT_DIB_H_ 106 #endif // UI_SURFACE_TRANSPORT_DIB_H_
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme_win.cc ('k') | ui/surface/transport_dib_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698