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

Side by Side Diff: net/url_request/url_request_job_manager.h

Issue 10068021: Fix file access on Chrome for ChromeOS on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang problem Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Register a protocol factory associated with the given scheme. The factory 58 // Register a protocol factory associated with the given scheme. The factory
59 // parameter may be null to clear any existing association. Returns the 59 // parameter may be null to clear any existing association. Returns the
60 // previously registered protocol factory if any. 60 // previously registered protocol factory if any.
61 URLRequest::ProtocolFactory* RegisterProtocolFactory( 61 URLRequest::ProtocolFactory* RegisterProtocolFactory(
62 const std::string& scheme, URLRequest::ProtocolFactory* factory); 62 const std::string& scheme, URLRequest::ProtocolFactory* factory);
63 63
64 // Register/unregister a request interceptor. 64 // Register/unregister a request interceptor.
65 void RegisterRequestInterceptor(URLRequest::Interceptor* interceptor); 65 void RegisterRequestInterceptor(URLRequest::Interceptor* interceptor);
66 void UnregisterRequestInterceptor(URLRequest::Interceptor* interceptor); 66 void UnregisterRequestInterceptor(URLRequest::Interceptor* interceptor);
67 67
68 void set_enable_file_access(bool enable) { enable_file_access_ = enable; } 68 void set_file_access_allowed(bool allow) { file_access_allowed_ = allow; }
69 bool enable_file_access() const { return enable_file_access_; } 69 bool file_access_allowed() const { return file_access_allowed_; }
70 70
71 private: 71 private:
72 typedef std::map<std::string, URLRequest::ProtocolFactory*> FactoryMap; 72 typedef std::map<std::string, URLRequest::ProtocolFactory*> FactoryMap;
73 typedef std::vector<URLRequest::Interceptor*> InterceptorList; 73 typedef std::vector<URLRequest::Interceptor*> InterceptorList;
74 friend struct DefaultSingletonTraits<URLRequestJobManager>; 74 friend struct DefaultSingletonTraits<URLRequestJobManager>;
75 75
76 URLRequestJobManager(); 76 URLRequestJobManager();
77 ~URLRequestJobManager(); 77 ~URLRequestJobManager();
78 78
79 // The first guy to call this function sets the allowed thread. This way we 79 // The first guy to call this function sets the allowed thread. This way we
80 // avoid needing to define that thread externally. Since we expect all 80 // avoid needing to define that thread externally. Since we expect all
81 // callers to be on the same thread, we don't worry about threads racing to 81 // callers to be on the same thread, we don't worry about threads racing to
82 // set the allowed thread. 82 // set the allowed thread.
83 bool IsAllowedThread() const { 83 bool IsAllowedThread() const {
84 #if 0 84 #if 0
85 if (!allowed_thread_initialized_) { 85 if (!allowed_thread_initialized_) {
86 allowed_thread_ = base::PlatformThread::CurrentId(); 86 allowed_thread_ = base::PlatformThread::CurrentId();
87 allowed_thread_initialized_ = true; 87 allowed_thread_initialized_ = true;
88 } 88 }
89 return allowed_thread_ == base::PlatformThread::CurrentId(); 89 return allowed_thread_ == base::PlatformThread::CurrentId();
90 #else 90 #else
91 // The previous version of this check used GetCurrentThread on Windows to 91 // The previous version of this check used GetCurrentThread on Windows to
92 // get thread handles to compare. Unfortunately, GetCurrentThread returns 92 // get thread handles to compare. Unfortunately, GetCurrentThread returns
93 // a constant psuedo-handle (0xFFFFFFFE), and therefore IsAllowedThread 93 // a constant pseudo-handle (0xFFFFFFFE), and therefore IsAllowedThread
94 // always returned true. The above code that's turned off is the correct 94 // always returned true. The above code that's turned off is the correct
95 // code, but causes the tree to turn red because some caller isn't 95 // code, but causes the tree to turn red because some caller isn't
96 // respecting our thread requirements. We're turning off the check for now; 96 // respecting our thread requirements. We're turning off the check for now;
97 // bug http://b/issue?id=1338969 has been filed to fix things and turn the 97 // bug http://b/issue?id=1338969 has been filed to fix things and turn the
98 // check back on. 98 // check back on.
99 return true; 99 return true;
100 } 100 }
101 101
102 // We use this to assert that CreateJob and the registration functions all 102 // We use this to assert that CreateJob and the registration functions all
103 // run on the same thread. 103 // run on the same thread.
104 mutable base::PlatformThreadId allowed_thread_; 104 mutable base::PlatformThreadId allowed_thread_;
105 mutable bool allowed_thread_initialized_; 105 mutable bool allowed_thread_initialized_;
106 #endif 106 #endif
107 107
108 mutable base::Lock lock_; 108 mutable base::Lock lock_;
109 FactoryMap factories_; 109 FactoryMap factories_;
110 InterceptorList interceptors_; 110 InterceptorList interceptors_;
111 bool enable_file_access_; 111 bool file_access_allowed_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); 113 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager);
114 }; 114 };
115 115
116 } // namespace net 116 } // namespace net
117 117
118 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ 118 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698