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 #include "printing/backend/print_backend.h" | 5 #include "printing/backend/print_backend.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <errno.h> | 10 #include <errno.h> |
11 #include <pthread.h> | 11 #include <pthread.h> |
12 | 12 |
13 #if defined(OS_MACOSX) | 13 #if defined(OS_MACOSX) |
14 #include <AvailabilityMacros.h> | 14 #include <AvailabilityMacros.h> |
15 #else | 15 #else |
16 #include <gcrypt.h> | 16 #include <gcrypt.h> |
17 #endif | 17 #endif |
18 | 18 |
| 19 #include "base/debug/leak_annotations.h" |
19 #include "base/file_util.h" | 20 #include "base/file_util.h" |
20 #include "base/lazy_instance.h" | 21 #include "base/lazy_instance.h" |
21 #include "base/logging.h" | 22 #include "base/logging.h" |
22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
23 #include "base/synchronization/lock.h" | 24 #include "base/synchronization/lock.h" |
24 #include "base/values.h" | 25 #include "base/values.h" |
25 #include "printing/backend/cups_helper.h" | 26 #include "printing/backend/cups_helper.h" |
26 #include "printing/backend/print_backend_consts.h" | 27 #include "printing/backend/print_backend_consts.h" |
27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
28 | 29 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 continue; | 74 continue; |
74 } | 75 } |
75 const char* kGnuTlsInitFuncName = "gnutls_global_init"; | 76 const char* kGnuTlsInitFuncName = "gnutls_global_init"; |
76 int (*pgnutls_global_init)(void) = reinterpret_cast<int(*)()>( | 77 int (*pgnutls_global_init)(void) = reinterpret_cast<int(*)()>( |
77 dlsym(gnutls_lib, kGnuTlsInitFuncName)); | 78 dlsym(gnutls_lib, kGnuTlsInitFuncName)); |
78 if (!pgnutls_global_init) { | 79 if (!pgnutls_global_init) { |
79 VLOG(1) << "Could not find " << kGnuTlsInitFuncName | 80 VLOG(1) << "Could not find " << kGnuTlsInitFuncName |
80 << " in " << kGnuTlsFiles[i]; | 81 << " in " << kGnuTlsFiles[i]; |
81 continue; | 82 continue; |
82 } | 83 } |
83 if ((*pgnutls_global_init)() != 0) | 84 { |
84 LOG(ERROR) << "gnutls_global_init() failed"; | 85 // GnuTLS has a genuine small memory leak that is easier to annotate |
| 86 // than suppress. See http://crbug.com/176888#c7 |
| 87 // TODO(earthdok): remove this once the leak is fixed. |
| 88 ANNOTATE_SCOPED_MEMORY_LEAK; |
| 89 if ((*pgnutls_global_init)() != 0) |
| 90 LOG(ERROR) << "gnutls_global_init() failed"; |
| 91 } |
85 return; | 92 return; |
86 } | 93 } |
87 LOG(ERROR) << "Cannot find libgnutls"; | 94 LOG(ERROR) << "Cannot find libgnutls"; |
88 } | 95 } |
89 }; | 96 }; |
90 | 97 |
91 base::LazyInstance<GcryptInitializer> g_gcrypt_initializer = | 98 base::LazyInstance<GcryptInitializer> g_gcrypt_initializer = |
92 LAZY_INSTANCE_INITIALIZER; | 99 LAZY_INSTANCE_INITIALIZER; |
93 | 100 |
94 } // namespace | 101 } // namespace |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 << ", HTTP error: " << http_error; | 377 << ", HTTP error: " << http_error; |
371 base::DeleteFile(ppd_path, false); | 378 base::DeleteFile(ppd_path, false); |
372 ppd_path.clear(); | 379 ppd_path.clear(); |
373 } | 380 } |
374 } | 381 } |
375 } | 382 } |
376 return ppd_path; | 383 return ppd_path; |
377 } | 384 } |
378 | 385 |
379 } // namespace printing | 386 } // namespace printing |
OLD | NEW |