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

Side by Side Diff: third_party/mojo/src/mojo/edk/system/platform_handle_dispatcher.cc

Issue 1309103002: Revert of Update mojo sdk to rev c02a28868825edfa57ab77947b8cb15e741c5598 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/edk/system/platform_handle_dispatcher.h" 5 #include "mojo/edk/system/platform_handle_dispatcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 namespace system { 12 namespace system {
13 13
14 namespace { 14 namespace {
15 15
16 const size_t kInvalidPlatformHandleIndex = static_cast<size_t>(-1); 16 const size_t kInvalidPlatformHandleIndex = static_cast<size_t>(-1);
17 17
18 struct SerializedPlatformHandleDispatcher { 18 struct SerializedPlatformHandleDispatcher {
19 size_t platform_handle_index; // (Or |kInvalidPlatformHandleIndex|.) 19 size_t platform_handle_index; // (Or |kInvalidPlatformHandleIndex|.)
20 }; 20 };
21 21
22 } // namespace 22 } // namespace
23 23
24 embedder::ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() { 24 embedder::ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() {
25 MutexLocker locker(&mutex()); 25 base::AutoLock locker(lock());
26 return platform_handle_.Pass(); 26 return platform_handle_.Pass();
27 } 27 }
28 28
29 Dispatcher::Type PlatformHandleDispatcher::GetType() const { 29 Dispatcher::Type PlatformHandleDispatcher::GetType() const {
30 return Type::PLATFORM_HANDLE; 30 return Type::PLATFORM_HANDLE;
31 } 31 }
32 32
33 // static 33 // static
34 scoped_refptr<PlatformHandleDispatcher> PlatformHandleDispatcher::Deserialize( 34 scoped_refptr<PlatformHandleDispatcher> PlatformHandleDispatcher::Deserialize(
35 Channel* channel, 35 Channel* channel,
(...skipping 30 matching lines...) Expand all
66 66
67 PlatformHandleDispatcher::PlatformHandleDispatcher( 67 PlatformHandleDispatcher::PlatformHandleDispatcher(
68 embedder::ScopedPlatformHandle platform_handle) 68 embedder::ScopedPlatformHandle platform_handle)
69 : platform_handle_(platform_handle.Pass()) { 69 : platform_handle_(platform_handle.Pass()) {
70 } 70 }
71 71
72 PlatformHandleDispatcher::~PlatformHandleDispatcher() { 72 PlatformHandleDispatcher::~PlatformHandleDispatcher() {
73 } 73 }
74 74
75 void PlatformHandleDispatcher::CloseImplNoLock() { 75 void PlatformHandleDispatcher::CloseImplNoLock() {
76 mutex().AssertHeld(); 76 lock().AssertAcquired();
77 platform_handle_.reset(); 77 platform_handle_.reset();
78 } 78 }
79 79
80 scoped_refptr<Dispatcher> 80 scoped_refptr<Dispatcher>
81 PlatformHandleDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { 81 PlatformHandleDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
82 mutex().AssertHeld(); 82 lock().AssertAcquired();
83 return Create(platform_handle_.Pass()); 83 return Create(platform_handle_.Pass());
84 } 84 }
85 85
86 void PlatformHandleDispatcher::StartSerializeImplNoLock( 86 void PlatformHandleDispatcher::StartSerializeImplNoLock(
87 Channel* /*channel*/, 87 Channel* /*channel*/,
88 size_t* max_size, 88 size_t* max_size,
89 size_t* max_platform_handles) { 89 size_t* max_platform_handles) {
90 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. 90 DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
91 *max_size = sizeof(SerializedPlatformHandleDispatcher); 91 *max_size = sizeof(SerializedPlatformHandleDispatcher);
92 *max_platform_handles = 1; 92 *max_platform_handles = 1;
(...skipping 14 matching lines...) Expand all
107 } else { 107 } else {
108 serialization->platform_handle_index = kInvalidPlatformHandleIndex; 108 serialization->platform_handle_index = kInvalidPlatformHandleIndex;
109 } 109 }
110 110
111 *actual_size = sizeof(SerializedPlatformHandleDispatcher); 111 *actual_size = sizeof(SerializedPlatformHandleDispatcher);
112 return true; 112 return true;
113 } 113 }
114 114
115 } // namespace system 115 } // namespace system
116 } // namespace mojo 116 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698