| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // Notifies the provider that the list of extensions has been updated. | 62 // Notifies the provider that the list of extensions has been updated. |
| 63 virtual void OnUpdated(std::unique_ptr<base::DictionaryValue> updated_prefs); | 63 virtual void OnUpdated(std::unique_ptr<base::DictionaryValue> updated_prefs); |
| 64 | 64 |
| 65 // Used for passing the list of extensions from the method that loads them | 65 // Used for passing the list of extensions from the method that loads them |
| 66 // to |LoadFinished|. To ensure thread safety, the rules are the following: | 66 // to |LoadFinished|. To ensure thread safety, the rules are the following: |
| 67 // if this value is written on another thread than the UI, then it should | 67 // if this value is written on another thread than the UI, then it should |
| 68 // only be written in a task that was posted from |StartLoading|. After that, | 68 // only be written in a task that was posted from |StartLoading|. After that, |
| 69 // this task should invoke |LoadFinished| with a PostTask. This scheme of | 69 // this task should invoke |LoadFinished| with a PostTask. This scheme of |
| 70 // posting tasks will avoid concurrent access and imply the necessary memory | 70 // posting tasks will avoid concurrent access and imply the necessary memory |
| 71 // barriers. | 71 // barriers. |
| 72 // TODO(lazyboy): To avoid |prefs_| getting unexpectedly overwritten before it |
| 73 // is consumed, consider passing the prefs directly in LoadFinished(). |
| 72 std::unique_ptr<base::DictionaryValue> prefs_; | 74 std::unique_ptr<base::DictionaryValue> prefs_; |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 friend class base::RefCountedThreadSafe<ExternalLoader>; | 77 friend class base::RefCountedThreadSafe<ExternalLoader>; |
| 76 | 78 |
| 77 ExternalProviderImpl* owner_; // weak | 79 ExternalProviderImpl* owner_; // weak |
| 78 | 80 |
| 79 DISALLOW_COPY_AND_ASSIGN(ExternalLoader); | 81 DISALLOW_COPY_AND_ASSIGN(ExternalLoader); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace extensions | 84 } // namespace extensions |
| 83 | 85 |
| 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ | 86 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_LOADER_H_ |
| OLD | NEW |