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

Side by Side Diff: mojo/edk/embedder/embedder.cc

Issue 1957713003: EDK: Remove Core::GetDispatcher(). (Closed) Base URL: https://github.com/domokit/mojo.git@work789_edk_handle_table_14-x-work788_edk_handle_13.9-x-work787_edk_handle_13.8
Patch Set: Created 4 years, 7 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 | « no previous file | mojo/edk/system/core.h » ('j') | mojo/edk/system/handle_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/edk/embedder/embedder_internal.h" 8 #include "mojo/edk/embedder/embedder_internal.h"
9 #include "mojo/edk/system/configuration.h" 9 #include "mojo/edk/system/configuration.h"
10 #include "mojo/edk/system/core.h" 10 #include "mojo/edk/system/core.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 *platform_handle_wrapper_handle = h; 67 *platform_handle_wrapper_handle = h;
68 return MOJO_RESULT_OK; 68 return MOJO_RESULT_OK;
69 } 69 }
70 70
71 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle, 71 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
72 ScopedPlatformHandle* platform_handle) { 72 ScopedPlatformHandle* platform_handle) {
73 DCHECK(platform_handle); 73 DCHECK(platform_handle);
74 74
75 DCHECK(internal::g_core); 75 DCHECK(internal::g_core);
76 RefPtr<system::Dispatcher> dispatcher; 76 system::Handle h;
77 MojoResult result = internal::g_core->GetDispatcher( 77 MojoResult result =
78 platform_handle_wrapper_handle, &dispatcher); 78 internal::g_core->GetHandle(platform_handle_wrapper_handle, &h);
79 if (result != MOJO_RESULT_OK) 79 if (result != MOJO_RESULT_OK)
80 return result; 80 return result;
81 81
82 if (dispatcher->GetType() != system::Dispatcher::Type::PLATFORM_HANDLE) 82 if (h.dispatcher->GetType() != system::Dispatcher::Type::PLATFORM_HANDLE)
83 return MOJO_RESULT_INVALID_ARGUMENT; 83 return MOJO_RESULT_INVALID_ARGUMENT;
84 84
85 if (!h.has_all_rights(MOJO_HANDLE_RIGHT_READ | MOJO_HANDLE_RIGHT_WRITE))
86 return MOJO_RESULT_PERMISSION_DENIED;
87
85 *platform_handle = 88 *platform_handle =
86 static_cast<system::PlatformHandleDispatcher*>(dispatcher.get()) 89 static_cast<system::PlatformHandleDispatcher*>(h.dispatcher.get())
87 ->PassPlatformHandle(); 90 ->PassPlatformHandle();
88 return MOJO_RESULT_OK; 91 return MOJO_RESULT_OK;
89 } 92 }
90 93
91 } // namespace embedder 94 } // namespace embedder
92 } // namespace mojo 95 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/core.h » ('j') | mojo/edk/system/handle_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698