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

Side by Side Diff: ppapi/shared_impl/ppapi_globals.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: export AssertLockHeld Created 8 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 | « ppapi/shared_impl/ppapi_globals.h ('k') | ppapi/shared_impl/ppb_audio_config_shared.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) 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 "ppapi/shared_impl/ppapi_globals.h" 5 #include "ppapi/shared_impl/ppapi_globals.h"
6 6
7 #include "base/lazy_instance.h" // For testing purposes only. 7 #include "base/lazy_instance.h" // For testing purposes only.
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h"
9 #include "base/threading/thread_local.h" // For testing purposes only. 10 #include "base/threading/thread_local.h" // For testing purposes only.
10 11
11 namespace ppapi { 12 namespace ppapi {
12 13
13 namespace { 14 namespace {
14 // Thread-local globals for testing. See SetPpapiGlobalsOnThreadForTest for more 15 // Thread-local globals for testing. See SetPpapiGlobalsOnThreadForTest for more
15 // information. 16 // information.
16 base::LazyInstance<base::ThreadLocalPointer<PpapiGlobals> >::Leaky 17 base::LazyInstance<base::ThreadLocalPointer<PpapiGlobals> >::Leaky
17 tls_ppapi_globals_for_test = LAZY_INSTANCE_INITIALIZER; 18 tls_ppapi_globals_for_test = LAZY_INSTANCE_INITIALIZER;
18 } // namespace 19 } // namespace
(...skipping 15 matching lines...) Expand all
34 } 35 }
35 36
36 // static 37 // static
37 void PpapiGlobals::SetPpapiGlobalsOnThreadForTest(PpapiGlobals* ptr) { 38 void PpapiGlobals::SetPpapiGlobalsOnThreadForTest(PpapiGlobals* ptr) {
38 // If we're using a per-thread PpapiGlobals, we should not have a global one. 39 // If we're using a per-thread PpapiGlobals, we should not have a global one.
39 // If we allowed it, it would always over-ride the "test" versions. 40 // If we allowed it, it would always over-ride the "test" versions.
40 DCHECK(!ppapi_globals_); 41 DCHECK(!ppapi_globals_);
41 tls_ppapi_globals_for_test.Pointer()->Set(ptr); 42 tls_ppapi_globals_for_test.Pointer()->Set(ptr);
42 } 43 }
43 44
45 base::MessageLoopProxy* PpapiGlobals::GetMainThreadMessageLoop() {
46 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::MessageLoopProxy>, proxy,
47 (base::MessageLoopProxy::current()));
48 return proxy.get();
49 }
50
44 bool PpapiGlobals::IsHostGlobals() const { 51 bool PpapiGlobals::IsHostGlobals() const {
45 return false; 52 return false;
46 } 53 }
47 54
48 bool PpapiGlobals::IsPluginGlobals() const { 55 bool PpapiGlobals::IsPluginGlobals() const {
49 return false; 56 return false;
50 } 57 }
51 58
52 // static 59 // static
53 PpapiGlobals* PpapiGlobals::GetThreadLocalPointer() { 60 PpapiGlobals* PpapiGlobals::GetThreadLocalPointer() {
54 return tls_ppapi_globals_for_test.Pointer()->Get(); 61 return tls_ppapi_globals_for_test.Pointer()->Get();
55 } 62 }
56 63
57 } // namespace ppapi 64 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppapi_globals.h ('k') | ppapi/shared_impl/ppb_audio_config_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698