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

Side by Side Diff: content/browser/device_orientation/provider.cc

Issue 18572014: Implement Android shared memory data fetcher for Device Motion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-sync-12June-tryASYNC-2-bis-tryRebase-6
Patch Set: rebased Created 7 years, 5 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
OLDNEW
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 "content/browser/device_orientation/provider.h" 5 #include "content/browser/device_orientation/provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/device_orientation/data_fetcher.h" 8 #include "content/browser/device_orientation/data_fetcher.h"
9 #include "content/browser/device_orientation/provider_impl.h" 9 #include "content/browser/device_orientation/provider_impl.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 11
12 #if defined(OS_MACOSX) 12 #if defined(OS_MACOSX)
13 #include "content/browser/device_orientation/accelerometer_mac.h" 13 #include "content/browser/device_orientation/accelerometer_mac.h"
14 #elif defined(OS_ANDROID) 14 #elif defined(OS_ANDROID)
15 #include "content/browser/device_orientation/data_fetcher_impl_android.h" 15 #include "content/browser/device_orientation/data_fetcher_orientation_android.h"
16 #elif defined(OS_WIN) 16 #elif defined(OS_WIN)
17 #include "content/browser/device_orientation/data_fetcher_impl_win.h" 17 #include "content/browser/device_orientation/data_fetcher_impl_win.h"
18 #endif 18 #endif
19 19
20 namespace content { 20 namespace content {
21 21
22 Provider* Provider::GetInstance() { 22 Provider* Provider::GetInstance() {
23 if (!instance_) { 23 if (!instance_) {
24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 24 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
25 ProviderImpl::DataFetcherFactory default_factory = NULL; 25 ProviderImpl::DataFetcherFactory default_factory = NULL;
26 26
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 default_factory = AccelerometerMac::Create; 28 default_factory = AccelerometerMac::Create;
29 #elif defined(OS_ANDROID) 29 #elif defined(OS_ANDROID)
30 default_factory = DataFetcherImplAndroid::Create; 30 default_factory = DataFetcherOrientationAndroid::Create;
31 #elif defined(OS_WIN) 31 #elif defined(OS_WIN)
32 default_factory = DataFetcherImplWin::Create; 32 default_factory = DataFetcherImplWin::Create;
33 #endif 33 #endif
34 34
35 instance_ = new ProviderImpl(default_factory); 35 instance_ = new ProviderImpl(default_factory);
36 } 36 }
37 return instance_; 37 return instance_;
38 } 38 }
39 39
40 void Provider::SetInstanceForTests(Provider* provider) { 40 void Provider::SetInstanceForTests(Provider* provider) {
41 DCHECK(!instance_); 41 DCHECK(!instance_);
42 instance_ = provider; 42 instance_ = provider;
43 } 43 }
44 44
45 Provider* Provider::GetInstanceForTests() { 45 Provider* Provider::GetInstanceForTests() {
46 return instance_; 46 return instance_;
47 } 47 }
48 48
49 Provider::Provider() { 49 Provider::Provider() {
50 } 50 }
51 51
52 Provider::~Provider() { 52 Provider::~Provider() {
53 DCHECK(instance_ == this); 53 DCHECK(instance_ == this);
54 instance_ = NULL; 54 instance_ = NULL;
55 } 55 }
56 56
57 Provider* Provider::instance_ = NULL; 57 Provider* Provider::instance_ = NULL;
58 58
59 } // namespace content 59 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/device_orientation/device_motion_provider.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698