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

Side by Side Diff: media/base/media.cc

Issue 16252006: Refactor BlockDifference() to use MediaInitializer(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android. Cleanup checks. Created 7 years, 6 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 | « no previous file | media/media.gyp » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/base/media.h" 5 #include "media/base/media.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "media/base/sinc_resampler.h" 12 #include "media/base/sinc_resampler.h"
13 #include "media/base/vector_math.h" 13 #include "media/base/vector_math.h"
14 #include "media/base/yuv_convert.h" 14 #include "media/base/yuv_convert.h"
15 #include "media/video/capture/screen/differ_block.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 namespace internal { 19 namespace internal {
19 // Platform specific initialization method. 20 // Platform specific initialization method.
20 extern bool InitializeMediaLibraryInternal(const base::FilePath& module_dir); 21 extern bool InitializeMediaLibraryInternal(const base::FilePath& module_dir);
21 } // namespace internal 22 } // namespace internal
22 23
23 // Media must only be initialized once, so use a LazyInstance to ensure this. 24 // Media must only be initialized once, so use a LazyInstance to ensure this.
24 class MediaInitializer { 25 class MediaInitializer {
(...skipping 18 matching lines...) Expand all
43 MediaInitializer() 44 MediaInitializer()
44 : initialized_(false), 45 : initialized_(false),
45 tried_initialize_(false) { 46 tried_initialize_(false) {
46 // Perform initialization of libraries which require runtime CPU detection. 47 // Perform initialization of libraries which require runtime CPU detection.
47 // TODO(dalecurtis): Add initialization of YUV, SincResampler. 48 // TODO(dalecurtis): Add initialization of YUV, SincResampler.
48 vector_math::Initialize(); 49 vector_math::Initialize();
49 #if !defined(OS_IOS) 50 #if !defined(OS_IOS)
50 SincResampler::InitializeCPUSpecificFeatures(); 51 SincResampler::InitializeCPUSpecificFeatures();
51 InitializeCPUSpecificYUVConversions(); 52 InitializeCPUSpecificYUVConversions();
52 #endif 53 #endif
54 #if defined(SCREEN_CAPTURE_SUPPORTED)
55 InitializeCPUSpecificBlockDifference();
56 #endif
53 } 57 }
54 58
55 ~MediaInitializer() { 59 ~MediaInitializer() {
56 NOTREACHED() << "MediaInitializer should be leaky!"; 60 NOTREACHED() << "MediaInitializer should be leaky!";
57 } 61 }
58 62
59 base::Lock lock_; 63 base::Lock lock_;
60 bool initialized_; 64 bool initialized_;
61 bool tried_initialize_; 65 bool tried_initialize_;
62 66
(...skipping 16 matching lines...) Expand all
79 bool IsMediaLibraryInitialized() { 83 bool IsMediaLibraryInitialized() {
80 return g_media_library.Get().IsInitialized(); 84 return g_media_library.Get().IsInitialized();
81 } 85 }
82 86
83 void InitializeCPUSpecificMediaFeatures() { 87 void InitializeCPUSpecificMediaFeatures() {
84 // Force initialization of the media initializer, but don't call Initialize(). 88 // Force initialization of the media initializer, but don't call Initialize().
85 g_media_library.Get(); 89 g_media_library.Get();
86 } 90 }
87 91
88 } // namespace media 92 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698