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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ObjectConstructor.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 16 matching lines...) Expand all
27 #include "bindings/core/v8/V8Binding.h" 27 #include "bindings/core/v8/V8Binding.h"
28 #include "platform/instrumentation/tracing/TraceEvent.h" 28 #include "platform/instrumentation/tracing/TraceEvent.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 v8::MaybeLocal<v8::Object> V8ObjectConstructor::NewInstance( 32 v8::MaybeLocal<v8::Object> V8ObjectConstructor::NewInstance(
33 v8::Isolate* isolate, 33 v8::Isolate* isolate,
34 v8::Local<v8::Function> function, 34 v8::Local<v8::Function> function,
35 int argc, 35 int argc,
36 v8::Local<v8::Value> argv[]) { 36 v8::Local<v8::Value> argv[]) {
37 ASSERT(!function.IsEmpty()); 37 DCHECK(!function.IsEmpty());
38 TRACE_EVENT0("v8", "v8.newInstance"); 38 TRACE_EVENT0("v8", "v8.newInstance");
39 ConstructorMode constructor_mode(isolate); 39 ConstructorMode constructor_mode(isolate);
40 v8::MicrotasksScope microtasks_scope( 40 v8::MicrotasksScope microtasks_scope(
41 isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); 41 isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
42 v8::MaybeLocal<v8::Object> result = 42 v8::MaybeLocal<v8::Object> result =
43 function->NewInstance(isolate->GetCurrentContext(), argc, argv); 43 function->NewInstance(isolate->GetCurrentContext(), argc, argv);
44 CHECK(!isolate->IsDead()); 44 CHECK(!isolate->IsDead());
45 return result; 45 return result;
46 } 46 }
47 47
48 void V8ObjectConstructor::IsValidConstructorMode( 48 void V8ObjectConstructor::IsValidConstructorMode(
49 const v8::FunctionCallbackInfo<v8::Value>& info) { 49 const v8::FunctionCallbackInfo<v8::Value>& info) {
50 if (ConstructorMode::Current(info.GetIsolate()) == 50 if (ConstructorMode::Current(info.GetIsolate()) ==
51 ConstructorMode::kCreateNewObject) { 51 ConstructorMode::kCreateNewObject) {
52 V8ThrowException::ThrowTypeError(info.GetIsolate(), "Illegal constructor"); 52 V8ThrowException::ThrowTypeError(info.GetIsolate(), "Illegal constructor");
53 return; 53 return;
54 } 54 }
55 V8SetReturnValue(info, info.Holder()); 55 V8SetReturnValue(info, info.Holder());
56 } 56 }
57 57
58 } // namespace blink 58 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698