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

Side by Side Diff: chrome/common/extensions/extension_resource.cc

Issue 3983005: Revert 63600 - Thread IO safety: annotate file_util, and block IO thread from... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « chrome/browser/service/service_process_control.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('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 "chrome/common/extensions/extension_resource.h" 5 #include "chrome/common/extensions/extension_resource.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/thread_restrictions.h"
10 9
11 PlatformThreadId ExtensionResource::file_thread_id_ = 0; 10 PlatformThreadId ExtensionResource::file_thread_id_ = 0;
12 11
13 bool ExtensionResource::check_for_file_thread_ = false; 12 bool ExtensionResource::check_for_file_thread_ = false;
14 13
15 ExtensionResource::ExtensionResource() { 14 ExtensionResource::ExtensionResource() {
16 } 15 }
17 16
18 ExtensionResource::ExtensionResource(const std::string& extension_id, 17 ExtensionResource::ExtensionResource(const std::string& extension_id,
19 const FilePath& extension_root, 18 const FilePath& extension_root,
(...skipping 19 matching lines...) Expand all
39 } 38 }
40 39
41 const FilePath& ExtensionResource::GetFilePath() const { 40 const FilePath& ExtensionResource::GetFilePath() const {
42 ExtensionResource::CheckFileAccessFromFileThread(); 41 ExtensionResource::CheckFileAccessFromFileThread();
43 return GetFilePathOnAnyThreadHack(); 42 return GetFilePathOnAnyThreadHack();
44 } 43 }
45 44
46 // static 45 // static
47 FilePath ExtensionResource::GetFilePathOnAnyThreadHack( 46 FilePath ExtensionResource::GetFilePathOnAnyThreadHack(
48 const FilePath& extension_root, const FilePath& relative_path) { 47 const FilePath& extension_root, const FilePath& relative_path) {
49 // This function is a hack, and causes us to block the IO thread.
50 // Fixing
51 // http://code.google.com/p/chromium/issues/detail?id=59849
52 // would also fix this. Suppress the error for now.
53 base::ThreadRestrictions::ScopedAllowIO allow_io;
54
55 // We need to resolve the parent references in the extension_root 48 // We need to resolve the parent references in the extension_root
56 // path on its own because IsParent doesn't like parent references. 49 // path on its own because IsParent doesn't like parent references.
57 FilePath clean_extension_root(extension_root); 50 FilePath clean_extension_root(extension_root);
58 if (!file_util::AbsolutePath(&clean_extension_root)) 51 if (!file_util::AbsolutePath(&clean_extension_root))
59 return FilePath(); 52 return FilePath();
60 53
61 FilePath full_path = clean_extension_root.Append(relative_path); 54 FilePath full_path = clean_extension_root.Append(relative_path);
62 55
63 // We must resolve the absolute path of the combined path when 56 // We must resolve the absolute path of the combined path when
64 // the relative path contains references to a parent folder (i.e., '..'). 57 // the relative path contains references to a parent folder (i.e., '..').
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Make sure we have a cached value to test against... 99 // Make sure we have a cached value to test against...
107 if (full_resource_path_.empty()) 100 if (full_resource_path_.empty())
108 GetFilePath(); 101 GetFilePath();
109 if (NormalizeSeperators(path.value()) == 102 if (NormalizeSeperators(path.value()) ==
110 NormalizeSeperators(full_resource_path_.value())) { 103 NormalizeSeperators(full_resource_path_.value())) {
111 return true; 104 return true;
112 } else { 105 } else {
113 return false; 106 return false;
114 } 107 }
115 } 108 }
OLDNEW
« no previous file with comments | « chrome/browser/service/service_process_control.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698