OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/core.h" | 5 #include "mojo/edk/system/core.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "mojo/edk/embedder/platform_shared_buffer.h" | 11 #include "mojo/edk/embedder/platform_shared_buffer.h" |
12 #include "mojo/edk/embedder/platform_support.h" | 12 #include "mojo/edk/embedder/platform_support.h" |
13 #include "mojo/edk/system/async_waiter.h" | 13 #include "mojo/edk/system/async_waiter.h" |
14 #include "mojo/edk/system/configuration.h" | 14 #include "mojo/edk/system/configuration.h" |
15 #include "mojo/edk/system/data_pipe.h" | 15 #include "mojo/edk/system/data_pipe.h" |
16 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" | 16 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
17 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" | 17 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
18 #include "mojo/edk/system/dispatcher.h" | 18 #include "mojo/edk/system/dispatcher.h" |
19 #include "mojo/edk/system/handle_signals_state.h" | 19 #include "mojo/edk/system/handle_signals_state.h" |
20 #include "mojo/edk/system/local_data_pipe_impl.h" | |
21 #include "mojo/edk/system/memory.h" | 20 #include "mojo/edk/system/memory.h" |
22 #include "mojo/edk/system/message_pipe.h" | 21 #include "mojo/edk/system/message_pipe.h" |
23 #include "mojo/edk/system/message_pipe_dispatcher.h" | 22 #include "mojo/edk/system/message_pipe_dispatcher.h" |
24 #include "mojo/edk/system/shared_buffer_dispatcher.h" | 23 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
25 #include "mojo/edk/system/waiter.h" | 24 #include "mojo/edk/system/waiter.h" |
26 #include "mojo/public/c/system/macros.h" | 25 #include "mojo/public/c/system/macros.h" |
27 | 26 |
28 namespace mojo { | 27 namespace mojo { |
29 namespace system { | 28 namespace system { |
30 | 29 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 373 } |
375 if (handle_pair.first == MOJO_HANDLE_INVALID) { | 374 if (handle_pair.first == MOJO_HANDLE_INVALID) { |
376 DCHECK_EQ(handle_pair.second, MOJO_HANDLE_INVALID); | 375 DCHECK_EQ(handle_pair.second, MOJO_HANDLE_INVALID); |
377 LOG(ERROR) << "Handle table full"; | 376 LOG(ERROR) << "Handle table full"; |
378 producer_dispatcher->Close(); | 377 producer_dispatcher->Close(); |
379 consumer_dispatcher->Close(); | 378 consumer_dispatcher->Close(); |
380 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 379 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
381 } | 380 } |
382 DCHECK_NE(handle_pair.second, MOJO_HANDLE_INVALID); | 381 DCHECK_NE(handle_pair.second, MOJO_HANDLE_INVALID); |
383 | 382 |
384 scoped_refptr<DataPipe> data_pipe(new LocalDataPipeImpl(validated_options)); | 383 scoped_refptr<DataPipe> data_pipe(DataPipe::CreateLocal(validated_options)); |
385 producer_dispatcher->Init(data_pipe); | 384 producer_dispatcher->Init(data_pipe); |
386 consumer_dispatcher->Init(data_pipe); | 385 consumer_dispatcher->Init(data_pipe); |
387 | 386 |
388 data_pipe_producer_handle.Put(handle_pair.first); | 387 data_pipe_producer_handle.Put(handle_pair.first); |
389 data_pipe_consumer_handle.Put(handle_pair.second); | 388 data_pipe_consumer_handle.Put(handle_pair.second); |
390 return MOJO_RESULT_OK; | 389 return MOJO_RESULT_OK; |
391 } | 390 } |
392 | 391 |
393 MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, | 392 MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, |
394 UserPointer<const void> elements, | 393 UserPointer<const void> elements, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 if (signals_states) { | 599 if (signals_states) { |
601 for (; i < num_handles; i++) | 600 for (; i < num_handles; i++) |
602 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); | 601 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); |
603 } | 602 } |
604 | 603 |
605 return rv; | 604 return rv; |
606 } | 605 } |
607 | 606 |
608 } // namespace system | 607 } // namespace system |
609 } // namespace mojo | 608 } // namespace mojo |
OLD | NEW |