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

Side by Side Diff: components/font_service/font_service_app.cc

Issue 1468803002: Switch to static_assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assert1
Patch Set: message cleanup Created 5 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 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 "components/font_service/font_service_app.h" 5 #include "components/font_service/font_service_app.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "mojo/application/public/cpp/application_connection.h" 9 #include "mojo/application/public/cpp/application_connection.h"
10 #include "mojo/platform_handle/platform_handle_functions.h" 10 #include "mojo/platform_handle/platform_handle_functions.h"
11 11
12 COMPILE_ASSERT(static_cast<uint32>(SkTypeface::kNormal) == 12 static_assert(static_cast<uint32>(SkTypeface::kNormal) ==
13 static_cast<uint32>(font_service::TYPEFACE_STYLE_NORMAL), 13 static_cast<uint32>(font_service::TYPEFACE_STYLE_NORMAL),
14 typeface_flags_should_match); 14 "Skia and font service flags must match");
15 COMPILE_ASSERT(static_cast<uint32>(SkTypeface::kBold) == 15 static_assert(static_cast<uint32>(SkTypeface::kBold) ==
16 static_cast<uint32>(font_service::TYPEFACE_STYLE_BOLD), 16 static_cast<uint32>(font_service::TYPEFACE_STYLE_BOLD),
17 typeface_flags_should_match); 17 "Skia and font service flags must match");
18 COMPILE_ASSERT(static_cast<uint32>(SkTypeface::kItalic) == 18 static_assert(static_cast<uint32>(SkTypeface::kItalic) ==
19 static_cast<uint32>(font_service::TYPEFACE_STYLE_ITALIC), 19 static_cast<uint32>(font_service::TYPEFACE_STYLE_ITALIC),
20 typeface_flags_should_match); 20 "Skia and font service flags must match");
21 COMPILE_ASSERT( 21 static_assert(static_cast<uint32>(SkTypeface::kBoldItalic) ==
22 static_cast<uint32>(SkTypeface::kBoldItalic) == 22 static_cast<uint32>(font_service::TYPEFACE_STYLE_BOLD_ITALIC),
23 static_cast<uint32>(font_service::TYPEFACE_STYLE_BOLD_ITALIC), 23 "Skia and font service flags must match");
24 typeface_flags_should_match);
25 24
26 namespace { 25 namespace {
27 26
28 mojo::ScopedHandle GetHandleForPath(const base::FilePath& path) { 27 mojo::ScopedHandle GetHandleForPath(const base::FilePath& path) {
29 if (path.empty()) 28 if (path.empty())
30 return mojo::ScopedHandle(); 29 return mojo::ScopedHandle();
31 30
32 mojo::ScopedHandle to_pass; 31 mojo::ScopedHandle to_pass;
33 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); 32 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
34 if (!file.IsValid()) { 33 if (!file.IsValid()) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 int count = paths_.count(); 115 int count = paths_.count();
117 for (int i = 0; i < count; ++i) { 116 for (int i = 0; i < count; ++i) {
118 if (path == *paths_[i]) 117 if (path == *paths_[i])
119 return i; 118 return i;
120 } 119 }
121 *paths_.append() = new SkString(path); 120 *paths_.append() = new SkString(path);
122 return count; 121 return count;
123 } 122 }
124 123
125 } // namespace font_service 124 } // namespace font_service
OLDNEW
« no previous file with comments | « chrome/installer/util/util_constants.h ('k') | components/html_viewer/blink_basic_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698