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

Side by Side Diff: content/child/font_warmup_win.cc

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile cleanup and fix Created 4 years 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/child/font_warmup_win.h" 5 #include "content/child/font_warmup_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <map> 9 #include <map>
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return handle_entry->second; 143 return handle_entry->second;
144 } 144 }
145 } 145 }
146 return nullptr; 146 return nullptr;
147 } 147 }
148 148
149 scoped_refptr<FakeGdiObject> Create(uint32_t magic) { 149 scoped_refptr<FakeGdiObject> Create(uint32_t magic) {
150 base::AutoLock scoped_lock(objects_lock_); 150 base::AutoLock scoped_lock(objects_lock_);
151 curr_handle_++; 151 curr_handle_++;
152 // We don't support wrapping the fake handle value. 152 // We don't support wrapping the fake handle value.
153 void* handle = reinterpret_cast<void*>(curr_handle_.ValueOrDie()); 153 void* handle = reinterpret_cast<void*>(
154 static_cast<uintptr_t>(curr_handle_.ValueOrDie()));
154 scoped_refptr<FakeGdiObject> object(new FakeGdiObject(magic, handle)); 155 scoped_refptr<FakeGdiObject> object(new FakeGdiObject(magic, handle));
155 objects_[handle] = object; 156 objects_[handle] = object;
156 return object; 157 return object;
157 } 158 }
158 159
159 bool DeleteObject(void* obj, uint32_t magic) { 160 bool DeleteObject(void* obj, uint32_t magic) {
160 base::AutoLock scoped_lock(objects_lock_); 161 base::AutoLock scoped_lock(objects_lock_);
161 auto handle_entry = objects_.find(obj); 162 auto handle_entry = objects_.find(obj);
162 if (handle_entry != objects_.end() && 163 if (handle_entry != objects_.end() &&
163 handle_entry->second->magic() == magic) { 164 handle_entry->second->magic() == magic) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 427
427 void ResetEmulatedGdiHandlesForTesting() { 428 void ResetEmulatedGdiHandlesForTesting() {
428 g_fake_gdi_object_factory.Get().ResetObjectHandles(); 429 g_fake_gdi_object_factory.Get().ResetObjectHandles();
429 } 430 }
430 431
431 void SetPreSandboxWarmupFontMgrForTesting(SkFontMgr* fontmgr) { 432 void SetPreSandboxWarmupFontMgrForTesting(SkFontMgr* fontmgr) {
432 g_warmup_fontmgr = fontmgr; 433 g_warmup_fontmgr = fontmgr;
433 } 434 }
434 435
435 } // namespace content 436 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698