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

Side by Side Diff: mojo/edk/system/data_pipe_producer_dispatcher.cc

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.h ('k') | mojo/edk/system/data_pipe_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
6
7 #include "base/logging.h"
8 #include "mojo/edk/system/data_pipe.h"
9 #include "mojo/edk/system/memory.h"
10
11 namespace mojo {
12 namespace system {
13
14 DataPipeProducerDispatcher::DataPipeProducerDispatcher() {
15 }
16
17 void DataPipeProducerDispatcher::Init(scoped_refptr<DataPipe> data_pipe) {
18 DCHECK(data_pipe);
19 data_pipe_ = data_pipe;
20 }
21
22 Dispatcher::Type DataPipeProducerDispatcher::GetType() const {
23 return kTypeDataPipeProducer;
24 }
25
26 DataPipeProducerDispatcher::~DataPipeProducerDispatcher() {
27 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe.
28 DCHECK(!data_pipe_);
29 }
30
31 void DataPipeProducerDispatcher::CancelAllAwakablesNoLock() {
32 lock().AssertAcquired();
33 data_pipe_->ProducerCancelAllAwakables();
34 }
35
36 void DataPipeProducerDispatcher::CloseImplNoLock() {
37 lock().AssertAcquired();
38 data_pipe_->ProducerClose();
39 data_pipe_ = nullptr;
40 }
41
42 scoped_refptr<Dispatcher>
43 DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
44 lock().AssertAcquired();
45
46 scoped_refptr<DataPipeProducerDispatcher> rv =
47 new DataPipeProducerDispatcher();
48 rv->Init(data_pipe_);
49 data_pipe_ = nullptr;
50 return scoped_refptr<Dispatcher>(rv.get());
51 }
52
53 MojoResult DataPipeProducerDispatcher::WriteDataImplNoLock(
54 UserPointer<const void> elements,
55 UserPointer<uint32_t> num_bytes,
56 MojoWriteDataFlags flags) {
57 lock().AssertAcquired();
58 return data_pipe_->ProducerWriteData(
59 elements, num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
60 }
61
62 MojoResult DataPipeProducerDispatcher::BeginWriteDataImplNoLock(
63 UserPointer<void*> buffer,
64 UserPointer<uint32_t> buffer_num_bytes,
65 MojoWriteDataFlags flags) {
66 lock().AssertAcquired();
67
68 return data_pipe_->ProducerBeginWriteData(
69 buffer, buffer_num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
70 }
71
72 MojoResult DataPipeProducerDispatcher::EndWriteDataImplNoLock(
73 uint32_t num_bytes_written) {
74 lock().AssertAcquired();
75
76 return data_pipe_->ProducerEndWriteData(num_bytes_written);
77 }
78
79 HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsStateImplNoLock()
80 const {
81 lock().AssertAcquired();
82 return data_pipe_->ProducerGetHandleSignalsState();
83 }
84
85 MojoResult DataPipeProducerDispatcher::AddAwakableImplNoLock(
86 Awakable* awakable,
87 MojoHandleSignals signals,
88 uint32_t context,
89 HandleSignalsState* signals_state) {
90 lock().AssertAcquired();
91 return data_pipe_->ProducerAddAwakable(awakable, signals, context,
92 signals_state);
93 }
94
95 void DataPipeProducerDispatcher::RemoveAwakableImplNoLock(
96 Awakable* awakable,
97 HandleSignalsState* signals_state) {
98 lock().AssertAcquired();
99 data_pipe_->ProducerRemoveAwakable(awakable, signals_state);
100 }
101
102 bool DataPipeProducerDispatcher::IsBusyNoLock() const {
103 lock().AssertAcquired();
104 return data_pipe_->ProducerIsBusy();
105 }
106
107 } // namespace system
108 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe_producer_dispatcher.h ('k') | mojo/edk/system/data_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698