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

Side by Side Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_win.cc

Issue 1805803002: Add checks to font proxy for diagnostics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Relax some checks that cause unit tests to fail and are unlikely to be triggered anyway. Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/dwrite_font_proxy/dwrite_font_proxy_win.h" 5 #include "content/child/dwrite_font_proxy/dwrite_font_proxy_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 auto iter = family_names_.find(name); 65 auto iter = family_names_.find(name);
66 if (iter != family_names_.end()) { 66 if (iter != family_names_.end()) {
67 *index = iter->second; 67 *index = iter->second;
68 *exists = iter->second != UINT_MAX; 68 *exists = iter->second != UINT_MAX;
69 return S_OK; 69 return S_OK;
70 } 70 }
71 71
72 if (!sender_.Run()->Send( 72 if (!sender_.Run()->Send(
73 new DWriteFontProxyMsg_FindFamily(name, &family_index))) { 73 new DWriteFontProxyMsg_FindFamily(name, &family_index))) {
74 CHECK(false);
74 return E_FAIL; 75 return E_FAIL;
75 } 76 }
76 77
77 if (family_index != UINT32_MAX) { 78 if (family_index != UINT32_MAX) {
78 if (!CreateFamily(family_index)) 79 if (!CreateFamily(family_index))
79 return E_FAIL; 80 return E_FAIL;
80 *exists = TRUE; 81 *exists = TRUE;
81 *index = family_index; 82 *index = family_index;
82 families_[family_index]->SetName(name); 83 families_[family_index]->SetName(name);
83 } else { 84 } else {
(...skipping 24 matching lines...) Expand all
108 109
109 UINT32 DWriteFontCollectionProxy::GetFontFamilyCount() { 110 UINT32 DWriteFontCollectionProxy::GetFontFamilyCount() {
110 if (family_count_ != UINT_MAX) 111 if (family_count_ != UINT_MAX)
111 return family_count_; 112 return family_count_;
112 113
113 TRACE_EVENT0("dwrite", "FontProxy::GetFontFamilyCount"); 114 TRACE_EVENT0("dwrite", "FontProxy::GetFontFamilyCount");
114 115
115 uint32_t family_count = 0; 116 uint32_t family_count = 0;
116 if (!sender_.Run()->Send( 117 if (!sender_.Run()->Send(
117 new DWriteFontProxyMsg_GetFamilyCount(&family_count))) { 118 new DWriteFontProxyMsg_GetFamilyCount(&family_count))) {
119 CHECK(false);
118 return 0; 120 return 0;
119 } 121 }
122 CHECK(family_count != 0);
120 family_count_ = family_count; 123 family_count_ = family_count;
121 return family_count; 124 return family_count;
122 } 125 }
123 126
124 HRESULT DWriteFontCollectionProxy::GetFontFromFontFace( 127 HRESULT DWriteFontCollectionProxy::GetFontFromFontFace(
125 IDWriteFontFace* font_face, 128 IDWriteFontFace* font_face,
126 IDWriteFont** font) { 129 IDWriteFont** font) {
127 DCHECK(font_face); 130 DCHECK(font_face);
128 DCHECK(font); 131 DCHECK(font);
129 132
130 for (const auto& family : families_) { 133 for (const auto& family : families_) {
131 if (family && family->GetFontFromFontFace(font_face, font)) 134 if (family && family->GetFontFromFontFace(font_face, font)) {
132 return S_OK; 135 return S_OK;
136 }
133 } 137 }
138 // If the font came from our collection, at least one family should match
139 CHECK(false);
140
134 return E_FAIL; 141 return E_FAIL;
135 } 142 }
136 143
137 HRESULT DWriteFontCollectionProxy::CreateEnumeratorFromKey( 144 HRESULT DWriteFontCollectionProxy::CreateEnumeratorFromKey(
138 IDWriteFactory* factory, 145 IDWriteFactory* factory,
139 const void* collection_key, 146 const void* collection_key,
140 UINT32 collection_key_size, 147 UINT32 collection_key_size,
141 IDWriteFontFileEnumerator** font_file_enumerator) { 148 IDWriteFontFileEnumerator** font_file_enumerator) {
142 if (!collection_key || collection_key_size != sizeof(uint32_t)) 149 if (!collection_key || collection_key_size != sizeof(uint32_t)) {
150 CHECK(false);
143 return E_INVALIDARG; 151 return E_INVALIDARG;
152 }
144 153
145 TRACE_EVENT0("dwrite", "FontProxy::LoadingFontFiles"); 154 TRACE_EVENT0("dwrite", "FontProxy::LoadingFontFiles");
146 155
147 const uint32_t* family_index = 156 const uint32_t* family_index =
148 reinterpret_cast<const uint32_t*>(collection_key); 157 reinterpret_cast<const uint32_t*>(collection_key);
149 158
150 if (*family_index >= GetFontFamilyCount()) 159 if (*family_index >= GetFontFamilyCount()) {
151 return E_INVALIDARG; 160 return E_INVALIDARG;
161 }
152 162
153 // If we already loaded the family we should reuse the existing collection. 163 // If we already loaded the family we should reuse the existing collection.
154 DCHECK(!families_[*family_index]->IsLoaded()); 164 DCHECK(!families_[*family_index]->IsLoaded());
155 165
156 std::vector<base::string16> file_names; 166 std::vector<base::string16> file_names;
157 if (!sender_.Run()->Send( 167 if (!sender_.Run()->Send(
158 new DWriteFontProxyMsg_GetFontFiles(*family_index, &file_names))) { 168 new DWriteFontProxyMsg_GetFontFiles(*family_index, &file_names))) {
169 CHECK(false);
159 return E_FAIL; 170 return E_FAIL;
160 } 171 }
161 172
162 HRESULT hr = mswr::MakeAndInitialize<FontFileEnumerator>( 173 HRESULT hr = mswr::MakeAndInitialize<FontFileEnumerator>(
163 font_file_enumerator, factory, this, &file_names); 174 font_file_enumerator, factory, this, &file_names);
164 175
165 if (!SUCCEEDED(hr)) 176 if (!SUCCEEDED(hr)) {
177 CHECK(false);
166 return E_FAIL; 178 return E_FAIL;
179 }
167 180
168 return S_OK; 181 return S_OK;
169 } 182 }
170 183
171 HRESULT DWriteFontCollectionProxy::CreateStreamFromKey( 184 HRESULT DWriteFontCollectionProxy::CreateStreamFromKey(
172 const void* font_file_reference_key, 185 const void* font_file_reference_key,
173 UINT32 font_file_reference_key_size, 186 UINT32 font_file_reference_key_size,
174 IDWriteFontFileStream** font_file_stream) { 187 IDWriteFontFileStream** font_file_stream) {
175 if (!font_file_reference_key) 188 if (!font_file_reference_key) {
189 CHECK(false);
176 return E_FAIL; 190 return E_FAIL;
191 }
177 192
178 const base::char16* file_name = 193 const base::char16* file_name =
179 reinterpret_cast<const base::char16*>(font_file_reference_key); 194 reinterpret_cast<const base::char16*>(font_file_reference_key);
180 DCHECK_EQ(font_file_reference_key_size % sizeof(base::char16), 0u); 195 DCHECK_EQ(font_file_reference_key_size % sizeof(base::char16), 0u);
181 size_t file_name_size = 196 size_t file_name_size =
182 static_cast<size_t>(font_file_reference_key_size) / sizeof(base::char16); 197 static_cast<size_t>(font_file_reference_key_size) / sizeof(base::char16);
183 198
184 if (file_name_size == 0 || file_name[file_name_size - 1] != L'\0') 199 if (file_name_size == 0 || file_name[file_name_size - 1] != L'\0') {
200 CHECK(false);
185 return E_FAIL; 201 return E_FAIL;
202 }
186 203
187 TRACE_EVENT0("dwrite", "FontFileEnumerator::CreateStreamFromKey"); 204 TRACE_EVENT0("dwrite", "FontFileEnumerator::CreateStreamFromKey");
188 205
189 mswr::ComPtr<IDWriteFontFileStream> stream; 206 mswr::ComPtr<IDWriteFontFileStream> stream;
190 if (!SUCCEEDED(mswr::MakeAndInitialize<FontFileStream>(&stream, file_name))) 207 if (!SUCCEEDED(mswr::MakeAndInitialize<FontFileStream>(&stream, file_name))) {
208 CHECK(false);
191 return E_FAIL; 209 return E_FAIL;
210 }
192 *font_file_stream = stream.Detach(); 211 *font_file_stream = stream.Detach();
193 return S_OK; 212 return S_OK;
194 } 213 }
195 214
196 HRESULT DWriteFontCollectionProxy::RuntimeClassInitialize( 215 HRESULT DWriteFontCollectionProxy::RuntimeClassInitialize(
197 IDWriteFactory* factory, 216 IDWriteFactory* factory,
198 const base::Callback<IPC::Sender*(void)>& sender) { 217 const base::Callback<IPC::Sender*(void)>& sender) {
199 DCHECK(factory); 218 CHECK(factory);
200 219
201 factory_ = factory; 220 factory_ = factory;
202 sender_ = sender; 221 sender_ = sender;
203 222
204 HRESULT hr = factory->RegisterFontCollectionLoader(this); 223 HRESULT hr = factory->RegisterFontCollectionLoader(this);
205 DCHECK(SUCCEEDED(hr)); 224 CHECK(SUCCEEDED(hr));
206 hr = factory_->RegisterFontFileLoader(this); 225 hr = factory_->RegisterFontFileLoader(this);
207 DCHECK(SUCCEEDED(hr)); 226 CHECK(SUCCEEDED(hr));
208 return S_OK; 227 return S_OK;
209 } 228 }
210 229
211 void DWriteFontCollectionProxy::Unregister() { 230 void DWriteFontCollectionProxy::Unregister() {
212 factory_->UnregisterFontCollectionLoader(this); 231 factory_->UnregisterFontCollectionLoader(this);
213 factory_->UnregisterFontFileLoader(this); 232 factory_->UnregisterFontFileLoader(this);
214 } 233 }
215 234
216 bool DWriteFontCollectionProxy::LoadFamily( 235 bool DWriteFontCollectionProxy::LoadFamily(
217 UINT32 family_index, 236 UINT32 family_index,
218 IDWriteFontCollection** containing_collection) { 237 IDWriteFontCollection** containing_collection) {
219 TRACE_EVENT0("dwrite", "FontProxy::LoadFamily"); 238 TRACE_EVENT0("dwrite", "FontProxy::LoadFamily");
220 239
221 uint32_t index = family_index; 240 uint32_t index = family_index;
222 // CreateCustomFontCollection ends up calling 241 // CreateCustomFontCollection ends up calling
223 // DWriteFontCollectionProxy::CreateEnumeratorFromKey. 242 // DWriteFontCollectionProxy::CreateEnumeratorFromKey.
224 HRESULT hr = factory_->CreateCustomFontCollection( 243 HRESULT hr = factory_->CreateCustomFontCollection(
225 this /*collectionLoader*/, reinterpret_cast<const void*>(&index), 244 this /*collectionLoader*/, reinterpret_cast<const void*>(&index),
226 sizeof(index), containing_collection); 245 sizeof(index), containing_collection);
246 CHECK(SUCCEEDED(hr));
227 247
228 return SUCCEEDED(hr); 248 return SUCCEEDED(hr);
229 } 249 }
230 250
231 bool DWriteFontCollectionProxy::LoadFamilyNames( 251 bool DWriteFontCollectionProxy::LoadFamilyNames(
232 UINT32 family_index, 252 UINT32 family_index,
233 IDWriteLocalizedStrings** localized_strings) { 253 IDWriteLocalizedStrings** localized_strings) {
234 TRACE_EVENT0("dwrite", "FontProxy::LoadFamilyNames"); 254 TRACE_EVENT0("dwrite", "FontProxy::LoadFamilyNames");
235 255
236 std::vector<std::pair<base::string16, base::string16>> strings; 256 std::vector<std::pair<base::string16, base::string16>> strings;
237 if (!sender_.Run()->Send( 257 if (!sender_.Run()->Send(
238 new DWriteFontProxyMsg_GetFamilyNames(family_index, &strings))) { 258 new DWriteFontProxyMsg_GetFamilyNames(family_index, &strings))) {
259 CHECK(false);
239 return false; 260 return false;
240 } 261 }
241 262
242 HRESULT hr = mswr::MakeAndInitialize<DWriteLocalizedStrings>( 263 HRESULT hr = mswr::MakeAndInitialize<DWriteLocalizedStrings>(
243 localized_strings, &strings); 264 localized_strings, &strings);
244 265
266 CHECK(SUCCEEDED(hr));
245 return SUCCEEDED(hr); 267 return SUCCEEDED(hr);
246 } 268 }
247 269
248 bool DWriteFontCollectionProxy::CreateFamily(UINT32 family_index) { 270 bool DWriteFontCollectionProxy::CreateFamily(UINT32 family_index) {
249 if (family_index < families_.size() && families_[family_index]) 271 if (family_index < families_.size() && families_[family_index])
250 return true; 272 return true;
251 273
252 UINT32 family_count = GetFontFamilyCount(); 274 UINT32 family_count = GetFontFamilyCount();
253 if (family_index >= family_count) 275 if (family_index >= family_count) {
254 return false; 276 return false;
277 }
255 278
256 if (families_.size() < family_count) 279 if (families_.size() < family_count)
257 families_.resize(family_count); 280 families_.resize(family_count);
258 281
259 mswr::ComPtr<DWriteFontFamilyProxy> family; 282 mswr::ComPtr<DWriteFontFamilyProxy> family;
260 HRESULT hr = mswr::MakeAndInitialize<DWriteFontFamilyProxy>(&family, this, 283 HRESULT hr = mswr::MakeAndInitialize<DWriteFontFamilyProxy>(&family, this,
261 family_index); 284 family_index);
262 DCHECK(SUCCEEDED(hr)); 285 CHECK(SUCCEEDED(hr));
263 DCHECK_LT(family_index, families_.size()); 286 CHECK_LT(family_index, families_.size());
264 287
265 families_[family_index] = family; 288 families_[family_index] = family;
266 return true; 289 return true;
267 } 290 }
268 291
269 DWriteFontFamilyProxy::DWriteFontFamilyProxy() = default; 292 DWriteFontFamilyProxy::DWriteFontFamilyProxy() = default;
270 293
271 DWriteFontFamilyProxy::~DWriteFontFamilyProxy() = default; 294 DWriteFontFamilyProxy::~DWriteFontFamilyProxy() = default;
272 295
273 HRESULT DWriteFontFamilyProxy::GetFontCollection( 296 HRESULT DWriteFontFamilyProxy::GetFontCollection(
(...skipping 11 matching lines...) Expand all
285 // well save an IPC here. 308 // well save an IPC here.
286 if (!LoadFamily()) 309 if (!LoadFamily())
287 return 0; 310 return 0;
288 311
289 return family_->GetFontCount(); 312 return family_->GetFontCount();
290 } 313 }
291 314
292 HRESULT DWriteFontFamilyProxy::GetFont(UINT32 index, IDWriteFont** font) { 315 HRESULT DWriteFontFamilyProxy::GetFont(UINT32 index, IDWriteFont** font) {
293 DCHECK(font); 316 DCHECK(font);
294 317
295 if (index >= GetFontCount()) 318 if (index >= GetFontCount()) {
319 CHECK(false);
296 return E_INVALIDARG; 320 return E_INVALIDARG;
321 }
297 if (!LoadFamily()) 322 if (!LoadFamily())
298 return E_FAIL; 323 return E_FAIL;
299 324
300 return family_->GetFont(index, font); 325 return family_->GetFont(index, font);
301 } 326 }
302 327
303 HRESULT DWriteFontFamilyProxy::GetFamilyNames(IDWriteLocalizedStrings** names) { 328 HRESULT DWriteFontFamilyProxy::GetFamilyNames(IDWriteLocalizedStrings** names) {
304 DCHECK(names); 329 DCHECK(names);
305 330
306 // Prefer the real thing, if available. 331 // Prefer the real thing, if available.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 bool DWriteFontFamilyProxy::GetFontFromFontFace(IDWriteFontFace* font_face, 389 bool DWriteFontFamilyProxy::GetFontFromFontFace(IDWriteFontFace* font_face,
365 IDWriteFont** font) { 390 IDWriteFont** font) {
366 DCHECK(font_face); 391 DCHECK(font_face);
367 DCHECK(font); 392 DCHECK(font);
368 393
369 if (!family_) 394 if (!family_)
370 return false; 395 return false;
371 396
372 mswr::ComPtr<IDWriteFontCollection> collection; 397 mswr::ComPtr<IDWriteFontCollection> collection;
373 HRESULT hr = family_->GetFontCollection(&collection); 398 HRESULT hr = family_->GetFontCollection(&collection);
374 DCHECK(SUCCEEDED(hr)); 399 CHECK(SUCCEEDED(hr));
375 hr = collection->GetFontFromFontFace(font_face, font); 400 hr = collection->GetFontFromFontFace(font_face, font);
376 401
377 return SUCCEEDED(hr); 402 return SUCCEEDED(hr);
378 } 403 }
379 404
380 void DWriteFontFamilyProxy::SetName(const base::string16& family_name) { 405 void DWriteFontFamilyProxy::SetName(const base::string16& family_name) {
381 family_name_.assign(family_name); 406 family_name_.assign(family_name);
382 } 407 }
383 408
384 bool DWriteFontFamilyProxy::IsLoaded() { 409 bool DWriteFontFamilyProxy::IsLoaded() {
(...skipping 22 matching lines...) Expand all
407 // Some fonts are packaged in a single file containing multiple families. In 432 // Some fonts are packaged in a single file containing multiple families. In
408 // such a case we can find the right family by family name. 433 // such a case we can find the right family by family name.
409 DCHECK(!family_name_.empty()); 434 DCHECK(!family_name_.empty());
410 UINT32 family_index = 0; 435 UINT32 family_index = 0;
411 BOOL found = FALSE; 436 BOOL found = FALSE;
412 hr = 437 hr =
413 collection->FindFamilyName(family_name_.c_str(), &family_index, &found); 438 collection->FindFamilyName(family_name_.c_str(), &family_index, &found);
414 if (SUCCEEDED(hr) && found) { 439 if (SUCCEEDED(hr) && found) {
415 hr = collection->GetFontFamily(family_index, &family_); 440 hr = collection->GetFontFamily(family_index, &family_);
416 LogLoadFamilyResult(LOAD_FAMILY_SUCCESS_MATCHED_FAMILY); 441 LogLoadFamilyResult(LOAD_FAMILY_SUCCESS_MATCHED_FAMILY);
442 CHECK(SUCCEEDED(hr));
417 return SUCCEEDED(hr); 443 return SUCCEEDED(hr);
418 } 444 }
419 } 445 }
420 446
421 DCHECK_LE(family_count, 1u); 447 DCHECK_LE(family_count, 1u);
422 448
423 if (family_count == 0) { 449 if (family_count == 0) {
424 // This is really strange, we successfully loaded no fonts?! 450 // This is really strange, we successfully loaded no fonts?!
425 LogLoadFamilyResult(LOAD_FAMILY_ERROR_NO_FAMILIES); 451 LogLoadFamilyResult(LOAD_FAMILY_ERROR_NO_FAMILIES);
452 CHECK(false);
426 return false; 453 return false;
427 } 454 }
428 455
429 LogLoadFamilyResult(family_count == 1 ? LOAD_FAMILY_SUCCESS_SINGLE_FAMILY 456 LogLoadFamilyResult(family_count == 1 ? LOAD_FAMILY_SUCCESS_SINGLE_FAMILY
430 : LOAD_FAMILY_ERROR_MULTIPLE_FAMILIES); 457 : LOAD_FAMILY_ERROR_MULTIPLE_FAMILIES);
431 458
432 hr = collection->GetFontFamily(0, &family_); 459 hr = collection->GetFontFamily(0, &family_);
433 460
461 CHECK(SUCCEEDED(hr));
462
434 return SUCCEEDED(hr); 463 return SUCCEEDED(hr);
435 } 464 }
436 465
437 FontFileEnumerator::FontFileEnumerator() = default; 466 FontFileEnumerator::FontFileEnumerator() = default;
438 467
439 FontFileEnumerator::~FontFileEnumerator() = default; 468 FontFileEnumerator::~FontFileEnumerator() = default;
440 469
441 HRESULT FontFileEnumerator::GetCurrentFontFile(IDWriteFontFile** file) { 470 HRESULT FontFileEnumerator::GetCurrentFontFile(IDWriteFontFile** file) {
442 DCHECK(file); 471 DCHECK(file);
443 if (current_file_ >= file_names_.size()) 472 if (current_file_ >= file_names_.size()) {
473 CHECK(false);
444 return E_FAIL; 474 return E_FAIL;
475 }
445 476
446 TRACE_EVENT0("dwrite", "FontFileEnumerator::GetCurrentFontFile (memmap)"); 477 TRACE_EVENT0("dwrite", "FontFileEnumerator::GetCurrentFontFile (memmap)");
447 // CreateCustomFontFileReference ends up calling 478 // CreateCustomFontFileReference ends up calling
448 // DWriteFontCollectionProxy::CreateStreamFromKey. 479 // DWriteFontCollectionProxy::CreateStreamFromKey.
449 return factory_->CreateCustomFontFileReference( 480 HRESULT hr = factory_->CreateCustomFontFileReference(
450 reinterpret_cast<const void*>(file_names_[current_file_].c_str()), 481 reinterpret_cast<const void*>(file_names_[current_file_].c_str()),
451 (file_names_[current_file_].length() + 1) * sizeof(base::char16), 482 (file_names_[current_file_].length() + 1) * sizeof(base::char16),
452 loader_.Get() /*IDWriteFontFileLoader*/, file); 483 loader_.Get() /*IDWriteFontFileLoader*/, file);
484 CHECK(SUCCEEDED(hr));
485 return hr;
453 } 486 }
454 487
455 HRESULT FontFileEnumerator::MoveNext(BOOL* has_current_file) { 488 HRESULT FontFileEnumerator::MoveNext(BOOL* has_current_file) {
456 DCHECK(has_current_file); 489 DCHECK(has_current_file);
457 490
458 TRACE_EVENT0("dwrite", "FontFileEnumerator::MoveNext"); 491 TRACE_EVENT0("dwrite", "FontFileEnumerator::MoveNext");
459 if (next_file_ >= file_names_.size()) { 492 if (next_file_ >= file_names_.size()) {
460 *has_current_file = FALSE; 493 *has_current_file = FALSE;
461 current_file_ = UINT_MAX; 494 current_file_ = UINT_MAX;
462 return S_OK; 495 return S_OK;
(...skipping 27 matching lines...) Expand all
490 523
491 HRESULT FontFileStream::GetLastWriteTime(UINT64* last_write_time) { 524 HRESULT FontFileStream::GetLastWriteTime(UINT64* last_write_time) {
492 *last_write_time = 0; 525 *last_write_time = 0;
493 return S_OK; 526 return S_OK;
494 } 527 }
495 528
496 HRESULT FontFileStream::ReadFileFragment(const void** fragment_start, 529 HRESULT FontFileStream::ReadFileFragment(const void** fragment_start,
497 UINT64 fragment_offset, 530 UINT64 fragment_offset,
498 UINT64 fragment_size, 531 UINT64 fragment_size,
499 void** fragment_context) { 532 void** fragment_context) {
500 if (fragment_offset + fragment_size < fragment_offset) 533 if (fragment_offset + fragment_size < fragment_offset) {
534 CHECK(false);
501 return E_FAIL; 535 return E_FAIL;
502 if (fragment_offset + fragment_size > data_.length()) 536 }
537 if (fragment_offset + fragment_size > data_.length()) {
538 CHECK(false);
503 return E_FAIL; 539 return E_FAIL;
540 }
504 *fragment_start = data_.data() + fragment_offset; 541 *fragment_start = data_.data() + fragment_offset;
505 *fragment_context = nullptr; 542 *fragment_context = nullptr;
506 return S_OK; 543 return S_OK;
507 } 544 }
508 545
509 HRESULT FontFileStream::RuntimeClassInitialize( 546 HRESULT FontFileStream::RuntimeClassInitialize(
510 const base::string16& file_name) { 547 const base::string16& file_name) {
511 data_.Initialize(base::FilePath(file_name)); 548 data_.Initialize(base::FilePath(file_name));
512 if (!data_.IsValid()) 549 if (!data_.IsValid()) {
550 CHECK(false);
513 return E_FAIL; 551 return E_FAIL;
552 }
514 return S_OK; 553 return S_OK;
515 } 554 }
516 555
517 } // namespace content 556 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698