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

Side by Side Diff: app/surface/transport_dib_win.cc

Issue 6665029: Adds a TransportDIB::Id value that is explicitly invalid and use it when compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mebbe this one compiles? Created 9 years, 9 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 | Annotate | Revision Log
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 "app/surface/transport_dib.h" 5 #include "app/surface/transport_dib.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return NULL; 49 return NULL;
50 return dib.release(); 50 return dib.release();
51 } 51 }
52 52
53 // static 53 // static
54 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) { 54 TransportDIB* TransportDIB::CreateWithHandle(Handle handle) {
55 return new TransportDIB(handle); 55 return new TransportDIB(handle);
56 } 56 }
57 57
58 // static 58 // static
59 bool TransportDIB::is_valid(Handle dib) { 59 bool TransportDIB::is_valid_handle(Handle dib) {
60 return dib != NULL; 60 return dib != NULL;
61 } 61 }
62 62
63 // static
64 bool TransportDIB::is_valid_id(TransportDIB::Id id) {
65 return is_valid_handle(id.handle);
66 }
67
63 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { 68 skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
64 // This DIB already mapped the file into this process, but PlatformCanvas 69 // This DIB already mapped the file into this process, but PlatformCanvas
65 // will map it again. 70 // will map it again.
66 DCHECK(!memory()) << "Mapped file twice in the same process."; 71 DCHECK(!memory()) << "Mapped file twice in the same process.";
67 72
68 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas); 73 scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
69 if (!canvas->initialize(w, h, true, handle())) 74 if (!canvas->initialize(w, h, true, handle()))
70 return NULL; 75 return NULL;
71 return canvas.release(); 76 return canvas.release();
72 } 77 }
73 78
74 bool TransportDIB::Map() { 79 bool TransportDIB::Map() {
75 if (!is_valid(handle())) 80 if (!is_valid_handle(handle()))
76 return false; 81 return false;
77 if (memory()) 82 if (memory())
78 return true; 83 return true;
79 84
80 if (!shared_memory_.Map(0 /* map whole shared memory segment */)) { 85 if (!shared_memory_.Map(0 /* map whole shared memory segment */)) {
81 LOG(ERROR) << "Failed to map transport DIB" 86 LOG(ERROR) << "Failed to map transport DIB"
82 << " handle:" << shared_memory_.handle() 87 << " handle:" << shared_memory_.handle()
83 << " error:" << ::GetLastError(); 88 << " error:" << ::GetLastError();
84 return false; 89 return false;
85 } 90 }
(...skipping 10 matching lines...) Expand all
96 return shared_memory_.memory(); 101 return shared_memory_.memory();
97 } 102 }
98 103
99 TransportDIB::Handle TransportDIB::handle() const { 104 TransportDIB::Handle TransportDIB::handle() const {
100 return shared_memory_.handle(); 105 return shared_memory_.handle();
101 } 106 }
102 107
103 TransportDIB::Id TransportDIB::id() const { 108 TransportDIB::Id TransportDIB::id() const {
104 return Id(handle(), sequence_num_); 109 return Id(handle(), sequence_num_);
105 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698