| 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 "chrome/browser/extensions/requirements_checker.h" | 5 #include "chrome/browser/extensions/requirements_checker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/gpu/gpu_feature_checker.h" | 9 #include "chrome/browser/gpu/gpu_feature_checker.h" |
| 10 #include "chrome/common/extensions/extension_manifest_constants.h" | 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 if (pending_requirement_checks_ == 0) { | 69 if (pending_requirement_checks_ == 0) { |
| 70 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 70 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 71 base::Bind(callback_, errors_)); | 71 base::Bind(callback_, errors_)); |
| 72 // Reset the callback so any ref-counted bound parameters will get released. | 72 // Reset the callback so any ref-counted bound parameters will get released. |
| 73 callback_.Reset(); | 73 callback_.Reset(); |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 // Running the GPU checkers down here removes any race condition that arises | 76 // Running the GPU checkers down here removes any race condition that arises |
| 77 // from the use of pending_requirement_checks_. | 77 // from the use of pending_requirement_checks_. |
| 78 if (webgl_checker_.get()) | 78 if (webgl_checker_) |
| 79 webgl_checker_->CheckGPUFeatureAvailability(); | 79 webgl_checker_->CheckGPUFeatureAvailability(); |
| 80 if (css3d_checker_.get()) | 80 if (css3d_checker_) |
| 81 css3d_checker_->CheckGPUFeatureAvailability(); | 81 css3d_checker_->CheckGPUFeatureAvailability(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void RequirementsChecker::SetWebGLAvailability(bool available) { | 84 void RequirementsChecker::SetWebGLAvailability(bool available) { |
| 85 if (!available) { | 85 if (!available) { |
| 86 errors_.push_back( | 86 errors_.push_back( |
| 87 l10n_util::GetStringUTF8(IDS_EXTENSION_WEBGL_NOT_SUPPORTED)); | 87 l10n_util::GetStringUTF8(IDS_EXTENSION_WEBGL_NOT_SUPPORTED)); |
| 88 } | 88 } |
| 89 MaybeRunCallback(); | 89 MaybeRunCallback(); |
| 90 } | 90 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 101 if (--pending_requirement_checks_ == 0) { | 101 if (--pending_requirement_checks_ == 0) { |
| 102 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 102 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 103 base::Bind(callback_, errors_)); | 103 base::Bind(callback_, errors_)); |
| 104 // Reset the callback so any ref-counted bound parameters will get released. | 104 // Reset the callback so any ref-counted bound parameters will get released. |
| 105 callback_.Reset(); | 105 callback_.Reset(); |
| 106 errors_.clear(); | 106 errors_.clear(); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace extensions | 110 } // namespace extensions |
| OLD | NEW |