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

Unified Diff: Source/bindings/dart/DartServiceInternal.cpp

Issue 128733002: Refactor service usage in Dartium (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1700
Patch Set: Created 6 years, 11 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
Index: Source/bindings/dart/DartServiceInternal.cpp
diff --git a/Source/bindings/dart/DartServiceInternal.cpp b/Source/bindings/dart/DartServiceInternal.cpp
deleted file mode 100644
index 6dee4c5e9d6358db1d029d8620c471deec3be2e8..0000000000000000000000000000000000000000
--- a/Source/bindings/dart/DartServiceInternal.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Each #include line has NOLINT because we cannot include "config.h" in
-// this file because it conflicts with Dart VM internals.
-
-// FIXME(15481): Expose these methods to the embedder API so
-// this file can be removed.
-#include "bindings/dart/DartServiceInternal.h" // NOLINT.
-
-// Map from Blink to Dart VM.
-#ifndef NDEBUG
-#define DEBUG
-#endif
-
-// Stop WebCorePrefixMac.h from killing the build.
-#if defined(new)
-#undef new
-#endif
-
-#if defined(delete)
-#undef delete
-#endif
-
-// Stop WinUser.h from renaming PostMessage to PostMessageW
-#ifdef PostMessage
-#undef PostMessage
-#endif
-
-#include "vm/dart_api_impl.h" // NOLINT.
-#include "vm/dart_api_state.h" // NOLINT.
-#include "vm/dart_entry.h" // NOLINT.
-#include "vm/isolate.h" // NOLINT.
-#include "vm/message.h" // NOLINT.
-#include "vm/native_arguments.h" // NOLINT.
-#include "vm/native_entry.h" // NOLINT.
-#include "vm/object.h" // NOLINT.
-#include "vm/port.h" // NOLINT.
-#include "vm/snapshot.h" // NOLINT.
-
-
-namespace WebCore {
-
-
-Dart_Port DartServiceInternal::GetPortIdFromPort(Dart_Handle port)
-{
- using namespace dart;
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- Instance& instance = Instance::Handle();
- instance ^= Api::UnwrapHandle(port);
- const Object& idObj = Object::Handle(DartLibraryCalls::PortGetId(instance));
- if (idObj.IsError()) {
- return ILLEGAL_PORT;
- }
- Integer& id = Integer::Handle();
- id ^= idObj.raw();
- return static_cast<Dart_Port>(id.AsInt64Value());
-}
-
-
-static uint8_t* allocator(uint8_t* ptr, intptr_t oldSize, intptr_t newSize)
-{
- void* newPtr = realloc(reinterpret_cast<void*>(ptr), newSize);
- return reinterpret_cast<uint8_t*>(newPtr);
-}
-
-
-static bool DartSendServiceMessage(Dart_Handle targetPort, Dart_Handle message)
-{
- using namespace dart;
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- Dart_Port spId = DartServiceInternal::GetPortIdFromPort(targetPort);
- if (spId == ILLEGAL_PORT) {
- return false;
- }
-
- // Serialize message.
- Object& msg = Object::Handle(Api::UnwrapHandle(message));
- uint8_t* data = 0;
- MessageWriter writer(&data, &allocator);
- writer.WriteMessage(msg);
-
- PortMap::PostMessage(new Message(spId, data, writer.BytesWritten(), Message::kOOBPriority));
- return true;
-}
-
-
-void DartServiceInternal::PostOOB(Dart_Handle targetPort, Dart_Handle message)
-{
- bool r = DartSendServiceMessage(targetPort, message);
- ASSERT(r);
-}
-
-}

Powered by Google App Engine
This is Rietveld 408576698