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

Side by Side Diff: src/messages.cc

Issue 1221433021: Move SmartPointer to base. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove some unecessary header includes 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/execution.h" 8 #include "src/execution.h"
9 #include "src/heap/spaces-inl.h" 9 #include "src/heap/spaces-inl.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
11 #include "src/string-builder.h" 11 #include "src/string-builder.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 16
17 // If no message listeners have been registered this one is called 17 // If no message listeners have been registered this one is called
18 // by default. 18 // by default.
19 void MessageHandler::DefaultMessageReport(Isolate* isolate, 19 void MessageHandler::DefaultMessageReport(Isolate* isolate,
20 const MessageLocation* loc, 20 const MessageLocation* loc,
21 Handle<Object> message_obj) { 21 Handle<Object> message_obj) {
22 SmartArrayPointer<char> str = GetLocalizedMessage(isolate, message_obj); 22 base::SmartArrayPointer<char> str = GetLocalizedMessage(isolate, message_obj);
23 if (loc == NULL) { 23 if (loc == NULL) {
24 PrintF("%s\n", str.get()); 24 PrintF("%s\n", str.get());
25 } else { 25 } else {
26 HandleScope scope(isolate); 26 HandleScope scope(isolate);
27 Handle<Object> data(loc->script()->name(), isolate); 27 Handle<Object> data(loc->script()->name(), isolate);
28 SmartArrayPointer<char> data_str; 28 base::SmartArrayPointer<char> data_str;
29 if (data->IsString()) 29 if (data->IsString())
30 data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS); 30 data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS);
31 PrintF("%s:%i: %s\n", data_str.get() ? data_str.get() : "<unknown>", 31 PrintF("%s:%i: %s\n", data_str.get() ? data_str.get() : "<unknown>",
32 loc->start_pos(), str.get()); 32 loc->start_pos(), str.get());
33 } 33 }
34 } 34 }
35 35
36 36
37 Handle<JSMessageObject> MessageHandler::MakeMessageObject( 37 Handle<JSMessageObject> MessageHandler::MakeMessageObject(
38 Isolate* isolate, MessageTemplate::Template message, MessageLocation* loc, 38 Isolate* isolate, MessageTemplate::Template message, MessageLocation* loc,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 127
128 Handle<String> MessageHandler::GetMessage(Isolate* isolate, 128 Handle<String> MessageHandler::GetMessage(Isolate* isolate,
129 Handle<Object> data) { 129 Handle<Object> data) {
130 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data); 130 Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data);
131 Handle<Object> arg = Handle<Object>(message->argument(), isolate); 131 Handle<Object> arg = Handle<Object>(message->argument(), isolate);
132 return MessageTemplate::FormatMessage(isolate, message->type(), arg); 132 return MessageTemplate::FormatMessage(isolate, message->type(), arg);
133 } 133 }
134 134
135 135
136 SmartArrayPointer<char> MessageHandler::GetLocalizedMessage( 136 base::SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
137 Isolate* isolate, 137 Isolate* isolate, Handle<Object> data) {
138 Handle<Object> data) {
139 HandleScope scope(isolate); 138 HandleScope scope(isolate);
140 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS); 139 return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS);
141 } 140 }
142 141
143 142
144 Handle<Object> CallSite::GetFileName(Isolate* isolate) { 143 Handle<Object> CallSite::GetFileName(Isolate* isolate) {
145 Handle<Object> script(fun_->shared()->script(), isolate); 144 Handle<Object> script(fun_->shared()->script(), isolate);
146 if (script->IsScript()) { 145 if (script->IsScript()) {
147 return Handle<Object>(Handle<Script>::cast(script)->name(), isolate); 146 return Handle<Object>(Handle<Script>::cast(script)->name(), isolate);
148 } 147 }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 363 }
365 } else { 364 } else {
366 builder.AppendCharacter(*c); 365 builder.AppendCharacter(*c);
367 } 366 }
368 } 367 }
369 368
370 return builder.Finish(); 369 return builder.Finish();
371 } 370 }
372 } // namespace internal 371 } // namespace internal
373 } // namespace v8 372 } // namespace v8
OLDNEW
« BUILD.gn ('K') | « src/messages.h ('k') | src/mips/codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698