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

Side by Side Diff: sky/viewer/internals.cc

Issue 1221163002: Remove two unused functions from dart:sky.internals (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « sky/viewer/internals.h ('k') | no next file » | no next file with comments »
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 "sky/viewer/internals.h" 5 #include "sky/viewer/internals.h"
6 6
7 #include "mojo/public/cpp/application/connect.h" 7 #include "mojo/public/cpp/application/connect.h"
8 #include "mojo/public/cpp/bindings/array.h" 8 #include "mojo/public/cpp/bindings/array.h"
9 #include "sky/engine/tonic/dart_builtin.h" 9 #include "sky/engine/tonic/dart_builtin.h"
10 #include "sky/engine/tonic/dart_converter.h" 10 #include "sky/engine/tonic/dart_converter.h"
11 #include "sky/engine/tonic/dart_error.h" 11 #include "sky/engine/tonic/dart_error.h"
12 #include "sky/viewer/document_view.h" 12 #include "sky/viewer/document_view.h"
13 #include "sky/viewer/runtime_flags.h" 13 #include "sky/viewer/runtime_flags.h"
14 #include <limits> 14 #include <limits>
15 15
16 using namespace blink; 16 using namespace blink;
17 17
18 namespace sky { 18 namespace sky {
19 namespace { 19 namespace {
20 20
21 int kInternalsKey = 0; 21 int kInternalsKey = 0;
22 22
23 Internals* GetInternals() { 23 Internals* GetInternals() {
24 DartState* state = DartState::Current(); 24 DartState* state = DartState::Current();
25 return static_cast<Internals*>(state->GetUserData(&kInternalsKey)); 25 return static_cast<Internals*>(state->GetUserData(&kInternalsKey));
26 } 26 }
27 27
28 void ContentAsText(Dart_NativeArguments args) {
29 Dart_Handle result = StdStringToDart(GetInternals()->ContentAsText());
30 Dart_SetReturnValue(args, result);
31 }
32
33 void NotifyTestComplete(Dart_NativeArguments args) { 28 void NotifyTestComplete(Dart_NativeArguments args) {
34 Dart_Handle test_result = Dart_GetNativeArgument(args, 0); 29 Dart_Handle test_result = Dart_GetNativeArgument(args, 0);
35 GetInternals()->NotifyTestComplete(StdStringFromDart(test_result)); 30 GetInternals()->NotifyTestComplete(StdStringFromDart(test_result));
36 } 31 }
37 32
38 void RenderTreeAsText(Dart_NativeArguments args) {
39 Dart_Handle result = StdStringToDart(GetInternals()->RenderTreeAsText());
40 Dart_SetReturnValue(args, result);
41 }
42
43 void TakeShellProxyHandle(Dart_NativeArguments args) { 33 void TakeShellProxyHandle(Dart_NativeArguments args) {
44 Dart_SetIntegerReturnValue(args, 34 Dart_SetIntegerReturnValue(args,
45 GetInternals()->TakeShellProxyHandle().value()); 35 GetInternals()->TakeShellProxyHandle().value());
46 } 36 }
47 37
48 void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) { 38 void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) {
49 Dart_SetIntegerReturnValue( 39 Dart_SetIntegerReturnValue(
50 args, GetInternals()->TakeServicesProvidedByEmbedder().value()); 40 args, GetInternals()->TakeServicesProvidedByEmbedder().value());
51 } 41 }
52 42
53 void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) { 43 void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) {
54 Dart_SetIntegerReturnValue( 44 Dart_SetIntegerReturnValue(
55 args, GetInternals()->TakeServicesProvidedToEmbedder().value()); 45 args, GetInternals()->TakeServicesProvidedToEmbedder().value());
56 } 46 }
57 47
58 void TakeServiceRegistry(Dart_NativeArguments args) { 48 void TakeServiceRegistry(Dart_NativeArguments args) {
59 Dart_SetIntegerReturnValue( 49 Dart_SetIntegerReturnValue(
60 args, GetInternals()->TakeServiceRegistry().value()); 50 args, GetInternals()->TakeServiceRegistry().value());
61 } 51 }
62 52
63 const DartBuiltin::Natives kNativeFunctions[] = { 53 const DartBuiltin::Natives kNativeFunctions[] = {
64 {"contentAsText", ContentAsText, 0},
65 {"notifyTestComplete", NotifyTestComplete, 1}, 54 {"notifyTestComplete", NotifyTestComplete, 1},
66 {"renderTreeAsText", RenderTreeAsText, 0},
67 {"takeShellProxyHandle", TakeShellProxyHandle, 0}, 55 {"takeShellProxyHandle", TakeShellProxyHandle, 0},
68 {"takeServicesProvidedByEmbedder", TakeServicesProvidedByEmbedder, 0}, 56 {"takeServicesProvidedByEmbedder", TakeServicesProvidedByEmbedder, 0},
69 {"takeServicesProvidedToEmbedder", TakeServicesProvidedToEmbedder, 0}, 57 {"takeServicesProvidedToEmbedder", TakeServicesProvidedToEmbedder, 0},
70 {"takeServiceRegistry", TakeServiceRegistry, 0}, 58 {"takeServiceRegistry", TakeServiceRegistry, 0},
71 }; 59 };
72 60
73 const DartBuiltin& GetBuiltin() { 61 const DartBuiltin& GetBuiltin() {
74 static DartBuiltin& builtin = *new DartBuiltin(kNativeFunctions, 62 static DartBuiltin& builtin = *new DartBuiltin(kNativeFunctions,
75 arraysize(kNativeFunctions)); 63 arraysize(kNativeFunctions));
76 return builtin; 64 return builtin;
(...skipping 24 matching lines...) Expand all
101 89
102 Internals::Internals(DocumentView* document_view) 90 Internals::Internals(DocumentView* document_view)
103 : document_view_(document_view->GetWeakPtr()), 91 : document_view_(document_view->GetWeakPtr()),
104 shell_binding_(this) { 92 shell_binding_(this) {
105 test_harness_ = document_view_->TakeTestHarness(); 93 test_harness_ = document_view_->TakeTestHarness();
106 } 94 }
107 95
108 Internals::~Internals() { 96 Internals::~Internals() {
109 } 97 }
110 98
111 std::string Internals::RenderTreeAsText() {
112 return std::string();
113 }
114
115 std::string Internals::ContentAsText() {
116 return std::string();
117 }
118
119 void Internals::NotifyTestComplete(const std::string& test_result) { 99 void Internals::NotifyTestComplete(const std::string& test_result) {
120 if (!RuntimeFlags::Get().testing()) 100 if (!RuntimeFlags::Get().testing())
121 return; 101 return;
122 std::vector<unsigned char> pixels; 102 std::vector<unsigned char> pixels;
123 document_view_->GetPixelsForTesting(&pixels); 103 document_view_->GetPixelsForTesting(&pixels);
124 if (test_harness_) { 104 if (test_harness_) {
125 test_harness_->OnTestComplete(test_result, 105 test_harness_->OnTestComplete(test_result,
126 mojo::Array<uint8_t>::From(pixels)); 106 mojo::Array<uint8_t>::From(pixels));
127 } 107 }
128 } 108 }
(...skipping 30 matching lines...) Expand all
159 const mojo::String& application_url, 139 const mojo::String& application_url,
160 mojo::InterfaceRequest<mojo::ServiceProvider> services, 140 mojo::InterfaceRequest<mojo::ServiceProvider> services,
161 mojo::ServiceProviderPtr exposed_services) { 141 mojo::ServiceProviderPtr exposed_services) {
162 if (document_view_) { 142 if (document_view_) {
163 document_view_->shell()->ConnectToApplication( 143 document_view_->shell()->ConnectToApplication(
164 application_url, services.Pass(), exposed_services.Pass()); 144 application_url, services.Pass(), exposed_services.Pass());
165 } 145 }
166 } 146 }
167 147
168 } // namespace sky 148 } // namespace sky
OLDNEW
« no previous file with comments | « sky/viewer/internals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698