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

Unified Diff: sky/tools/packager/logging.cc

Issue 1178213003: Introduce sky_packager (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/tools/packager/logging.h ('k') | sky/tools/packager/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/packager/logging.cc
diff --git a/sky/engine/tonic/dart_error.cc b/sky/tools/packager/logging.cc
similarity index 58%
copy from sky/engine/tonic/dart_error.cc
copy to sky/tools/packager/logging.cc
index d733c3328a60131644add913abcf50de8fb96190..e61820cb9725165ae14f6576eeca615fc75142e8 100644
--- a/sky/engine/tonic/dart_error.cc
+++ b/sky/tools/packager/logging.cc
@@ -2,19 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sky/engine/config.h"
-#include "sky/engine/tonic/dart_error.h"
+#include "sky/tools/packager/logging.h"
#include "base/logging.h"
-namespace blink {
-
-namespace DartError {
-
-const char kInvalidArgument[] = "Invalid argument.";
-
-} // namespace DartError
-
bool LogIfError(Dart_Handle handle) {
if (Dart_IsError(handle)) {
LOG(ERROR) << Dart_GetError(handle);
@@ -32,4 +23,15 @@ bool LogIfError(Dart_Handle handle) {
return false;
}
-} // namespace blink
+std::string StringFromDart(Dart_Handle string) {
+ CHECK(Dart_IsString(string));
+ uint8_t* utf8_array;
+ intptr_t length;
+ Dart_StringToUTF8(string, &utf8_array, &length);
+ return std::string(reinterpret_cast<const char*>(utf8_array), length);
+}
+
+Dart_Handle StringToDart(const std::string& string) {
+ return Dart_NewStringFromUTF8(reinterpret_cast<const uint8_t*>(string.data()),
+ string.length());
+}
« no previous file with comments | « sky/tools/packager/logging.h ('k') | sky/tools/packager/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698