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

Side by Side Diff: content/browser/compositor/software_output_device_win.cc

Issue 2509983004: Revert "Change call-sites now that SkCanvas is not ref-counted" (Closed)
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/compositor/software_output_device_win.h" 5 #include "content/browser/compositor/software_output_device_win.h"
6 6
7 #include "base/debug/alias.h" 7 #include "base/debug/alias.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "cc/resources/shared_bitmap.h" 9 #include "cc/resources/shared_bitmap.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (backing_) { 132 if (backing_) {
133 base::SharedMemory* memory = 133 base::SharedMemory* memory =
134 backing_->GetSharedMemory(viewport_pixel_size_); 134 backing_->GetSharedMemory(viewport_pixel_size_);
135 if (memory) { 135 if (memory) {
136 shared_section = memory->handle().GetHandle(); 136 shared_section = memory->handle().GetHandle();
137 } else { 137 } else {
138 can_create_contents = false; 138 can_create_contents = false;
139 } 139 }
140 } 140 }
141 if (can_create_contents) { 141 if (can_create_contents) {
142 contents_ = skia::CreatePlatformCanvas( 142 contents_ = sk_sp<SkCanvas>(skia::CreatePlatformCanvas(
143 viewport_pixel_size_.width(), viewport_pixel_size_.height(), true, 143 viewport_pixel_size_.width(), viewport_pixel_size_.height(), true,
144 shared_section, skia::CRASH_ON_FAILURE); 144 shared_section, skia::CRASH_ON_FAILURE));
145 } 145 }
146 } 146 }
147 147
148 damage_rect_ = damage_rect; 148 damage_rect_ = damage_rect;
149 in_paint_ = true; 149 in_paint_ = true;
150 return contents_.get(); 150 return contents_.get();
151 } 151 }
152 152
153 void SoftwareOutputDeviceWin::EndPaint() { 153 void SoftwareOutputDeviceWin::EndPaint() {
154 DCHECK_CURRENTLY_ON(BrowserThread::UI); 154 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 30 matching lines...) Expand all
185 } else { 185 } else {
186 HDC hdc = ::GetDC(hwnd_); 186 HDC hdc = ::GetDC(hwnd_);
187 RECT src_rect = rect.ToRECT(); 187 RECT src_rect = rect.ToRECT();
188 skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(), 188 skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(),
189 &src_rect); 189 &src_rect);
190 ::ReleaseDC(hwnd_, hdc); 190 ::ReleaseDC(hwnd_, hdc);
191 } 191 }
192 } 192 }
193 193
194 void SoftwareOutputDeviceWin::ReleaseContents() { 194 void SoftwareOutputDeviceWin::ReleaseContents() {
195 DCHECK(!contents_ || contents_->unique());
195 DCHECK(!in_paint_); 196 DCHECK(!in_paint_);
196 contents_.reset(); 197 contents_.reset();
197 } 198 }
198 199
199 } // namespace content 200 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/software_output_device_win.h ('k') | content/renderer/pepper/pepper_plugin_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698