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

Side by Side Diff: mojo/edk/js/core.cc

Issue 744723002: remove some calls to to-be-deprecated v8::Value::To* functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « extensions/renderer/v8_context_native_handler.cc ('k') | net/proxy/proxy_resolver_v8.cc » ('j') | 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 "mojo/edk/js/core.h" 5 #include "mojo/edk/js/core.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "gin/arguments.h" 9 #include "gin/arguments.h"
10 #include "gin/array_buffer.h" 10 #include "gin/array_buffer.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 MojoHandle handle0 = MOJO_HANDLE_INVALID; 51 MojoHandle handle0 = MOJO_HANDLE_INVALID;
52 MojoHandle handle1 = MOJO_HANDLE_INVALID; 52 MojoHandle handle1 = MOJO_HANDLE_INVALID;
53 MojoResult result = MOJO_RESULT_OK; 53 MojoResult result = MOJO_RESULT_OK;
54 54
55 v8::Handle<v8::Value> options_value = args.PeekNext(); 55 v8::Handle<v8::Value> options_value = args.PeekNext();
56 if (options_value.IsEmpty() || options_value->IsNull() || 56 if (options_value.IsEmpty() || options_value->IsNull() ||
57 options_value->IsUndefined()) { 57 options_value->IsUndefined()) {
58 result = MojoCreateMessagePipe(NULL, &handle0, &handle1); 58 result = MojoCreateMessagePipe(NULL, &handle0, &handle1);
59 } else if (options_value->IsObject()) { 59 } else if (options_value->IsObject()) {
60 gin::Dictionary options_dict(args.isolate(), options_value->ToObject()); 60 gin::Dictionary options_dict(args.isolate(),
61 options_value->ToObject(args.isolate()));
61 MojoCreateMessagePipeOptions options; 62 MojoCreateMessagePipeOptions options;
62 // For future struct_size, we can probably infer that from the presence of 63 // For future struct_size, we can probably infer that from the presence of
63 // properties in options_dict. For now, it's always 8. 64 // properties in options_dict. For now, it's always 8.
64 options.struct_size = 8; 65 options.struct_size = 8;
65 // Ideally these would be optional. But the interface makes it hard to 66 // Ideally these would be optional. But the interface makes it hard to
66 // typecheck them then. 67 // typecheck them then.
67 if (!options_dict.Get("flags", &options.flags)) { 68 if (!options_dict.Get("flags", &options.flags)) {
68 return dictionary; 69 return dictionary;
69 } 70 }
70 71
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 150
150 MojoHandle producer_handle = MOJO_HANDLE_INVALID; 151 MojoHandle producer_handle = MOJO_HANDLE_INVALID;
151 MojoHandle consumer_handle = MOJO_HANDLE_INVALID; 152 MojoHandle consumer_handle = MOJO_HANDLE_INVALID;
152 MojoResult result = MOJO_RESULT_OK; 153 MojoResult result = MOJO_RESULT_OK;
153 154
154 v8::Handle<v8::Value> options_value = args.PeekNext(); 155 v8::Handle<v8::Value> options_value = args.PeekNext();
155 if (options_value.IsEmpty() || options_value->IsNull() || 156 if (options_value.IsEmpty() || options_value->IsNull() ||
156 options_value->IsUndefined()) { 157 options_value->IsUndefined()) {
157 result = MojoCreateDataPipe(NULL, &producer_handle, &consumer_handle); 158 result = MojoCreateDataPipe(NULL, &producer_handle, &consumer_handle);
158 } else if (options_value->IsObject()) { 159 } else if (options_value->IsObject()) {
159 gin::Dictionary options_dict(args.isolate(), options_value->ToObject()); 160 gin::Dictionary options_dict(args.isolate(),
161 options_value->ToObject(args.isolate()));
160 MojoCreateDataPipeOptions options; 162 MojoCreateDataPipeOptions options;
161 // For future struct_size, we can probably infer that from the presence of 163 // For future struct_size, we can probably infer that from the presence of
162 // properties in options_dict. For now, it's always 16. 164 // properties in options_dict. For now, it's always 16.
163 options.struct_size = 16; 165 options.struct_size = 16;
164 // Ideally these would be optional. But the interface makes it hard to 166 // Ideally these would be optional. But the interface makes it hard to
165 // typecheck them then. 167 // typecheck them then.
166 if (!options_dict.Get("flags", &options.flags) || 168 if (!options_dict.Get("flags", &options.flags) ||
167 !options_dict.Get("elementNumBytes", &options.element_num_bytes) || 169 !options_dict.Get("elementNumBytes", &options.element_num_bytes) ||
168 !options_dict.Get("capacityNumBytes", &options.capacity_num_bytes)) { 170 !options_dict.Get("capacityNumBytes", &options.capacity_num_bytes)) {
169 return dictionary; 171 return dictionary;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 .Build(); 318 .Build();
317 319
318 data->SetObjectTemplate(&g_wrapper_info, templ); 320 data->SetObjectTemplate(&g_wrapper_info, templ);
319 } 321 }
320 322
321 return templ->NewInstance(); 323 return templ->NewInstance();
322 } 324 }
323 325
324 } // namespace js 326 } // namespace js
325 } // namespace mojo 327 } // namespace mojo
OLDNEW
« no previous file with comments | « extensions/renderer/v8_context_native_handler.cc ('k') | net/proxy/proxy_resolver_v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698