| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 font_data_length_ = font_data.length(); | 40 font_data_length_ = font_data.length(); |
| 41 if (font_data_length_ <= 0) { | 41 if (font_data_length_ <= 0) { |
| 42 LOG(ERROR) << "No font data: " << font_data_length_; | 42 LOG(ERROR) << "No font data: " << font_data_length_; |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 font_shmem_.reset(new base::SharedMemory); | 46 font_shmem_.reset(new base::SharedMemory); |
| 47 if (!font_shmem_.get()) { | 47 if (!font_shmem_) { |
| 48 LOG(ERROR) << "Failed to create shared memory object."; | 48 LOG(ERROR) << "Failed to create shared memory object."; |
| 49 return false; | 49 return false; |
| 50 } | 50 } |
| 51 | 51 |
| 52 if (!font_shmem_->CreateAndMapAnonymous(font_data_length_)) { | 52 if (!font_shmem_->CreateAndMapAnonymous(font_data_length_)) { |
| 53 LOG(ERROR) << "SharedMemory::Create failed"; | 53 LOG(ERROR) << "SharedMemory::Create failed"; |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 memcpy(font_shmem_->memory(), font_data.c_str(), font_data_length_); | 57 memcpy(font_shmem_->memory(), font_data.c_str(), font_data_length_); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 static_cast<const char *>(result.font_data.memory()), | 119 static_cast<const char *>(result.font_data.memory()), |
| 120 result.font_data_size); | 120 result.font_data_size); |
| 121 | 121 |
| 122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, | 122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, |
| 123 "FontLoadingTestCase", temp_file_path.value().c_str())); | 123 "FontLoadingTestCase", temp_file_path.value().c_str())); |
| 124 temp_file_closer.reset(); | 124 temp_file_closer.reset(); |
| 125 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); | 125 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace content | 128 } // namespace content |
| OLD | NEW |