OLD | NEW |
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 #include "content/renderer/render_process_impl.h" | 5 #include "content/renderer/render_process_impl.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 delete dib; | 144 delete dib; |
145 } | 145 } |
146 | 146 |
147 // ----------------------------------------------------------------------------- | 147 // ----------------------------------------------------------------------------- |
148 | 148 |
149 | 149 |
150 skia::PlatformCanvas* RenderProcessImpl::GetDrawingCanvas( | 150 skia::PlatformCanvas* RenderProcessImpl::GetDrawingCanvas( |
151 TransportDIB** memory, const gfx::Rect& rect) { | 151 TransportDIB** memory, const gfx::Rect& rect) { |
152 int width = rect.width(); | 152 int width = rect.width(); |
153 int height = rect.height(); | 153 int height = rect.height(); |
154 const size_t stride = skia::PlatformCanvas::StrideForWidth(rect.width()); | 154 const size_t stride = skia::PlatformCanvasStrideForWidth(rect.width()); |
155 #if defined(OS_LINUX) || defined(OS_OPENBSD) | 155 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
156 const size_t max_size = base::SysInfo::MaxSharedMemorySize(); | 156 const size_t max_size = base::SysInfo::MaxSharedMemorySize(); |
157 #else | 157 #else |
158 const size_t max_size = 0; | 158 const size_t max_size = 0; |
159 #endif | 159 #endif |
160 | 160 |
161 // If the requested size is too big, reduce the height. Ideally we might like | 161 // If the requested size is too big, reduce the height. Ideally we might like |
162 // to reduce the width as well to make the size reduction more "balanced", but | 162 // to reduce the width as well to make the size reduction more "balanced", but |
163 // it rarely comes up in practice. | 163 // it rarely comes up in practice. |
164 if ((max_size != 0) && (height * stride > max_size)) | 164 if ((max_size != 0) && (height * stride > max_size)) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 void RenderProcessImpl::ClearTransportDIBCache() { | 243 void RenderProcessImpl::ClearTransportDIBCache() { |
244 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { | 244 for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { |
245 if (shared_mem_cache_[i]) { | 245 if (shared_mem_cache_[i]) { |
246 FreeTransportDIB(shared_mem_cache_[i]); | 246 FreeTransportDIB(shared_mem_cache_[i]); |
247 shared_mem_cache_[i] = NULL; | 247 shared_mem_cache_[i] = NULL; |
248 } | 248 } |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 } // namespace content | 252 } // namespace content |
OLD | NEW |