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

Side by Side Diff: printing/backend/print_backend_cups.cc

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_job_manager.cc ('k') | printing/printed_document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 #if !defined(OS_MACOSX) 9 #if !defined(OS_MACOSX)
10 #include <gcrypt.h> 10 #include <gcrypt.h>
11 #endif 11 #endif
12 #include <pthread.h> 12 #include <pthread.h>
13 13
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/lock.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
18 #include "base/synchronization/lock.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
21 #include "printing/backend/cups_helper.h" 21 #include "printing/backend/cups_helper.h"
22 #include "printing/backend/print_backend_consts.h" 22 #include "printing/backend/print_backend_consts.h"
23 23
24 #if !defined(OS_MACOSX) 24 #if !defined(OS_MACOSX)
25 GCRY_THREAD_OPTION_PTHREAD_IMPL; 25 GCRY_THREAD_OPTION_PTHREAD_IMPL;
26 26
27 namespace { 27 namespace {
28 28
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } else { 213 } else {
214 HttpConnectionCUPS http(print_server_url_); 214 HttpConnectionCUPS http(print_server_url_);
215 http.SetBlocking(blocking_); 215 http.SetBlocking(blocking_);
216 return cupsGetDests2(http.http(), dests); 216 return cupsGetDests2(http.http(), dests);
217 } 217 }
218 } 218 }
219 219
220 FilePath PrintBackendCUPS::GetPPD(const char* name) { 220 FilePath PrintBackendCUPS::GetPPD(const char* name) {
221 // cupsGetPPD returns a filename stored in a static buffer in CUPS. 221 // cupsGetPPD returns a filename stored in a static buffer in CUPS.
222 // Protect this code with lock. 222 // Protect this code with lock.
223 static Lock ppd_lock; 223 static base::Lock ppd_lock;
224 AutoLock ppd_autolock(ppd_lock); 224 base::AutoLock ppd_autolock(ppd_lock);
225 FilePath ppd_path; 225 FilePath ppd_path;
226 const char* ppd_file_path = NULL; 226 const char* ppd_file_path = NULL;
227 if (print_server_url_.is_empty()) { // Use default (local) print server. 227 if (print_server_url_.is_empty()) { // Use default (local) print server.
228 ppd_file_path = cupsGetPPD(name); 228 ppd_file_path = cupsGetPPD(name);
229 if (ppd_file_path) 229 if (ppd_file_path)
230 ppd_path = FilePath(ppd_file_path); 230 ppd_path = FilePath(ppd_file_path);
231 } else { 231 } else {
232 // cupsGetPPD2 gets stuck sometimes in an infinite time due to network 232 // cupsGetPPD2 gets stuck sometimes in an infinite time due to network
233 // configuration/issues. To prevent that, use non-blocking http connection 233 // configuration/issues. To prevent that, use non-blocking http connection
234 // here. 234 // here.
(...skipping 23 matching lines...) Expand all
258 << ", content length: " << content_len; 258 << ", content length: " << content_len;
259 file_util::Delete(ppd_path, false); 259 file_util::Delete(ppd_path, false);
260 ppd_path.clear(); 260 ppd_path.clear();
261 } 261 }
262 } 262 }
263 } 263 }
264 return ppd_path; 264 return ppd_path;
265 } 265 }
266 266
267 } // namespace printing 267 } // namespace printing
OLDNEW
« no previous file with comments | « net/url_request/url_request_job_manager.cc ('k') | printing/printed_document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698