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 "ppapi/shared_impl/resource_tracker.h" | 5 #include "ppapi/shared_impl/resource_tracker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "ppapi/shared_impl/callback_tracker.h" | 10 #include "ppapi/shared_impl/callback_tracker.h" |
11 #include "ppapi/shared_impl/id_assignment.h" | 11 #include "ppapi/shared_impl/id_assignment.h" |
12 #include "ppapi/shared_impl/ppapi_globals.h" | 12 #include "ppapi/shared_impl/ppapi_globals.h" |
13 #include "ppapi/shared_impl/proxy_lock.h" | 13 #include "ppapi/shared_impl/proxy_lock.h" |
14 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
15 | 15 |
16 namespace ppapi { | 16 namespace ppapi { |
17 | 17 |
18 ResourceTracker::ResourceTracker(ThreadMode thread_mode) | 18 ResourceTracker::ResourceTracker(ThreadMode thread_mode) |
19 : last_resource_value_(0), | 19 : last_resource_value_(0), |
20 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 20 weak_ptr_factory_(this) { |
21 if (thread_mode == SINGLE_THREADED) | 21 if (thread_mode == SINGLE_THREADED) |
22 thread_checker_.reset(new base::ThreadChecker); | 22 thread_checker_.reset(new base::ThreadChecker); |
23 } | 23 } |
24 | 24 |
25 ResourceTracker::~ResourceTracker() { | 25 ResourceTracker::~ResourceTracker() { |
26 } | 26 } |
27 | 27 |
28 void ResourceTracker::CheckThreadingPreconditions() const { | 28 void ResourceTracker::CheckThreadingPreconditions() const { |
29 DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread()); | 29 DCHECK(!thread_checker_ || thread_checker_->CalledOnValidThread()); |
30 #ifndef NDEBUG | 30 #ifndef NDEBUG |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 CHECK(object->pp_instance() || is_message_loop); | 223 CHECK(object->pp_instance() || is_message_loop); |
224 CallbackTracker* callback_tracker = | 224 CallbackTracker* callback_tracker = |
225 PpapiGlobals::Get()->GetCallbackTrackerForInstance(object->pp_instance()); | 225 PpapiGlobals::Get()->GetCallbackTrackerForInstance(object->pp_instance()); |
226 CHECK(callback_tracker || is_message_loop); | 226 CHECK(callback_tracker || is_message_loop); |
227 if (callback_tracker) | 227 if (callback_tracker) |
228 callback_tracker->PostAbortForResource(object->pp_resource()); | 228 callback_tracker->PostAbortForResource(object->pp_resource()); |
229 object->NotifyLastPluginRefWasDeleted(); | 229 object->NotifyLastPluginRefWasDeleted(); |
230 } | 230 } |
231 | 231 |
232 } // namespace ppapi | 232 } // namespace ppapi |
OLD | NEW |