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

Side by Side Diff: chrome/common/transport_dib_mac.cc

Issue 126101: Adds kind-of-live thumbnail generation for a potential tab switcher. (Closed)
Patch Set: For Checking hopefully Created 11 years, 6 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 | « chrome/common/transport_dib_linux.cc ('k') | chrome/common/transport_dib_win.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/common/transport_dib.h" 5 #include "chrome/common/transport_dib.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include "base/eintr_wrapper.h" 10 #include "base/eintr_wrapper.h"
11 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
12 #include "skia/ext/platform_canvas.h"
12 13
13 TransportDIB::TransportDIB() 14 TransportDIB::TransportDIB()
14 : size_(0) { 15 : size_(0) {
15 } 16 }
16 17
17 TransportDIB::TransportDIB(TransportDIB::Handle dib) 18 TransportDIB::TransportDIB(TransportDIB::Handle dib)
18 : shared_memory_(dib, false /* read write */), 19 : shared_memory_(dib, false /* read write */),
19 size_(0) { 20 size_(0) {
20 } 21 }
21 22
(...skipping 23 matching lines...) Expand all
45 delete dib; 46 delete dib;
46 HANDLE_EINTR(close(handle.fd)); 47 HANDLE_EINTR(close(handle.fd));
47 return false; 48 return false;
48 } 49 }
49 50
50 dib->size_ = st.st_size; 51 dib->size_ = st.st_size;
51 52
52 return dib; 53 return dib;
53 } 54 }
54 55
56 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
57 return new skia::PlatformCanvas(w, h, true,
58 reinterpret_cast<uint8_t*>(dib->memory()));
59 }
60
55 void* TransportDIB::memory() const { 61 void* TransportDIB::memory() const {
56 return shared_memory_.memory(); 62 return shared_memory_.memory();
57 } 63 }
58 64
59 TransportDIB::Id TransportDIB::id() const { 65 TransportDIB::Id TransportDIB::id() const {
60 return shared_memory_.id(); 66 return shared_memory_.id();
61 } 67 }
62 68
63 TransportDIB::Handle TransportDIB::handle() const { 69 TransportDIB::Handle TransportDIB::handle() const {
64 return shared_memory_.handle(); 70 return shared_memory_.handle();
65 } 71 }
OLDNEW
« no previous file with comments | « chrome/common/transport_dib_linux.cc ('k') | chrome/common/transport_dib_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698