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

Unified Diff: mojo/dart/embedder/common.cc

Issue 1760523007: Add support for compression filters in the mojo dart:io (Closed) Base URL: git@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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/dart/embedder/common.h ('k') | mojo/dart/embedder/io/filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/dart/embedder/common.cc
diff --git a/mojo/dart/embedder/common.cc b/mojo/dart/embedder/common.cc
index ec5f3db6bb8425e052e8c1c4eb6e2020780d95f8..fe3eeb8243a6a29c49f30655ad33386bceea09c7 100644
--- a/mojo/dart/embedder/common.cc
+++ b/mojo/dart/embedder/common.cc
@@ -5,12 +5,39 @@
#include <stdint.h>
#include <string.h>
+#include "base/logging.h"
#include "mojo/dart/embedder/common.h"
#include "mojo/public/cpp/environment/logging.h"
namespace mojo {
namespace dart {
+Dart_Handle DartEmbedder::GetDartType(const char* library_url,
+ const char* class_name) {
+ return Dart_GetType(Dart_LookupLibrary(NewCString(library_url)),
+ NewCString(class_name), 0, NULL);
+}
+
+Dart_Handle DartEmbedder::NewDartExceptionWithMessage(
+ const char* library_url,
+ const char* error_type,
+ const char* message) {
+ // Create a Dart Exception object with a message.
+ Dart_Handle type = GetDartType(library_url, error_type);
+ DCHECK(!Dart_IsError(type));
+ if (message != NULL) {
+ Dart_Handle args[1];
+ args[0] = NewCString(message);
+ return Dart_New(type, Dart_Null(), 1, args);
+ } else {
+ return Dart_New(type, Dart_Null(), 0, NULL);
+ }
+}
+
+Dart_Handle DartEmbedder::NewInternalError(const char* message) {
+ return NewDartExceptionWithMessage("dart:core", "_InternalError", message);
+}
+
int64_t DartEmbedder::GetIntegerValue(Dart_Handle value_obj) {
int64_t value = 0;
Dart_Handle result = Dart_IntegerToInt64(value_obj, &value);
« no previous file with comments | « mojo/dart/embedder/common.h ('k') | mojo/dart/embedder/io/filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698