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

Side by Side Diff: mojo/services/log/cpp/lib/log_client.cc

Issue 1677753002: Mojo C++ bindings: InterfacePtr::PassInterface -> PassInterfaceHandle (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/services/log/cpp/log_client.h" 5 #include "mojo/services/log/cpp/log_client.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 void SetMinimumLogLevel(MojoLogLevel level); 48 void SetMinimumLogLevel(MojoLogLevel level);
49 49
50 private: 50 private:
51 const InterfaceHandle<mojo::log::Log> log_interface_; 51 const InterfaceHandle<mojo::log::Log> log_interface_;
52 const MojoLogger* const fallback_logger_; 52 const MojoLogger* const fallback_logger_;
53 53
54 MOJO_DISALLOW_COPY_AND_ASSIGN(LogClient); 54 MOJO_DISALLOW_COPY_AND_ASSIGN(LogClient);
55 }; 55 };
56 56
57 LogClient::LogClient(log::LogPtr log, const MojoLogger* fallback_logger) 57 LogClient::LogClient(log::LogPtr log, const MojoLogger* fallback_logger)
58 : log_interface_(log.PassInterface()), fallback_logger_(fallback_logger) { 58 : log_interface_(log.PassInterfaceHandle()),
59 fallback_logger_(fallback_logger) {
59 assert(log_interface_.is_valid()); 60 assert(log_interface_.is_valid());
60 assert(fallback_logger_); 61 assert(fallback_logger_);
61 } 62 }
62 63
63 void LogClient::LogMessage(MojoLogLevel log_level, 64 void LogClient::LogMessage(MojoLogLevel log_level,
64 const char* source_file, 65 const char* source_file,
65 uint32_t source_line, 66 uint32_t source_line,
66 const char* message) const { 67 const char* message) const {
67 // We avoid the use of C++ bindings to do interface calls in order to be 68 // We avoid the use of C++ bindings to do interface calls in order to be
68 // thread-safe (as of this writing, the bindings are not). Because the 69 // thread-safe (as of this writing, the bindings are not). Because the
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 162 }
162 163
163 void DestroyLogger() { 164 void DestroyLogger() {
164 assert(g_log_client); 165 assert(g_log_client);
165 delete g_log_client; 166 delete g_log_client;
166 g_log_client = nullptr; 167 g_log_client = nullptr;
167 } 168 }
168 169
169 } // namespace log 170 } // namespace log
170 } // namespace mojo 171 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/interface_ptr_internal.h ('k') | services/dart/content_handler_app_service_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698