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

Side by Side Diff: content/browser/renderer_host/software_frame_manager.cc

Issue 221523003: cc: Remove all usage of GetArea() from production code in cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: getarea: Created 6 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer_host/software_frame_manager.h" 5 #include "content/browser/renderer_host/software_frame_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/numerics/safe_math.h" 10 #include "base/numerics/safe_math.h"
11 #include "cc/resources/shared_bitmap.h"
11 #include "content/browser/renderer_host/dip_util.h" 12 #include "content/browser/renderer_host/dip_util.h"
12 #include "content/public/browser/user_metrics.h" 13 #include "content/public/browser/user_metrics.h"
13 14
14 namespace { 15 namespace {
15 16
16 void ReleaseMailbox(scoped_refptr<content::SoftwareFrame> frame, 17 void ReleaseMailbox(scoped_refptr<content::SoftwareFrame> frame,
17 uint32 sync_point, 18 uint32 sync_point,
18 bool lost_resource) {} 19 bool lost_resource) {}
19 20
20 } // namespace 21 } // namespace
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 scoped_ptr<base::SharedMemory> shared_memory( 91 scoped_ptr<base::SharedMemory> shared_memory(
91 new base::SharedMemory(frame_data->handle, true, 92 new base::SharedMemory(frame_data->handle, true,
92 process_handle)); 93 process_handle));
93 #else 94 #else
94 scoped_ptr<base::SharedMemory> shared_memory( 95 scoped_ptr<base::SharedMemory> shared_memory(
95 new base::SharedMemory(frame_data->handle, true)); 96 new base::SharedMemory(frame_data->handle, true));
96 #endif 97 #endif
97 98
98 // The NULL handle is used in testing. 99 // The NULL handle is used in testing.
99 if (base::SharedMemory::IsHandleValid(shared_memory->handle())) { 100 if (base::SharedMemory::IsHandleValid(shared_memory->handle())) {
100 DCHECK(frame_data->CheckedSizeInBytes().IsValid()) 101 DCHECK(cc::SharedBitmap::VerifySizeInBytes(frame_data->size));
101 << "Integer overflow when computing bytes to map."; 102 // UncheckedSizeInBytes is okay because the frame_data size was verified
102 size_t size_in_bytes = frame_data->SizeInBytes(); 103 // frame_data was received over IPC.
piman 2014/04/03 21:41:20 nit: missing 'when'?
danakj 2014/04/03 21:43:48 2014/04/03 21:41:20, piman wrote:
104 size_t size_in_bytes =
105 cc::SharedBitmap::UncheckedSizeInBytes(frame_data->size);
103 #ifdef OS_WIN 106 #ifdef OS_WIN
104 if (!shared_memory->Map(0)) { 107 if (!shared_memory->Map(0)) {
105 DLOG(ERROR) << "Unable to map renderer memory."; 108 DLOG(ERROR) << "Unable to map renderer memory.";
106 RecordAction( 109 RecordAction(
107 base::UserMetricsAction("BadMessageTerminate_SharedMemoryManager1")); 110 base::UserMetricsAction("BadMessageTerminate_SharedMemoryManager1"));
108 return false; 111 return false;
109 } 112 }
110 113
111 if (shared_memory->mapped_size() < size_in_bytes) { 114 if (shared_memory->mapped_size() < size_in_bytes) {
112 DLOG(ERROR) << "Shared memory too small for given rectangle"; 115 DLOG(ERROR) << "Shared memory too small for given rectangle";
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 203 }
201 204
202 void SoftwareFrameManager::EvictCurrentFrame() { 205 void SoftwareFrameManager::EvictCurrentFrame() {
203 DCHECK(HasCurrentFrame()); 206 DCHECK(HasCurrentFrame());
204 DiscardCurrentFrame(); 207 DiscardCurrentFrame();
205 if (client_) 208 if (client_)
206 client_->ReleaseReferencesToSoftwareFrame(); 209 client_->ReleaseReferencesToSoftwareFrame();
207 } 210 }
208 211
209 } // namespace content 212 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698