| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 #include <sys/socket.h> | 36 #include <sys/socket.h> |
| 37 #include <sys/resource.h> | 37 #include <sys/resource.h> |
| 38 #include <sys/time.h> | 38 #include <sys/time.h> |
| 39 #include <sys/types.h> | 39 #include <sys/types.h> |
| 40 | 40 |
| 41 #include <arpa/inet.h> | 41 #include <arpa/inet.h> |
| 42 #include <netinet/in.h> | 42 #include <netinet/in.h> |
| 43 #include <netdb.h> | 43 #include <netdb.h> |
| 44 | 44 |
| 45 #if defined(ANDROID) |
| 46 #define LOG_TAG "v8" |
| 47 #include <utils/Log.h> // LOG_PRI_VA |
| 48 #endif |
| 49 |
| 45 #include "v8.h" | 50 #include "v8.h" |
| 46 | 51 |
| 47 #include "platform.h" | 52 #include "platform.h" |
| 48 | 53 |
| 49 | |
| 50 namespace v8 { | 54 namespace v8 { |
| 51 namespace internal { | 55 namespace internal { |
| 52 | 56 |
| 53 | 57 |
| 54 // ---------------------------------------------------------------------------- | 58 // ---------------------------------------------------------------------------- |
| 55 // POSIX date/time support. | 59 // POSIX date/time support. |
| 56 // | 60 // |
| 57 | 61 |
| 58 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { | 62 int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
| 59 struct rusage usage; | 63 struct rusage usage; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 123 |
| 120 void OS::Print(const char* format, ...) { | 124 void OS::Print(const char* format, ...) { |
| 121 va_list args; | 125 va_list args; |
| 122 va_start(args, format); | 126 va_start(args, format); |
| 123 VPrint(format, args); | 127 VPrint(format, args); |
| 124 va_end(args); | 128 va_end(args); |
| 125 } | 129 } |
| 126 | 130 |
| 127 | 131 |
| 128 void OS::VPrint(const char* format, va_list args) { | 132 void OS::VPrint(const char* format, va_list args) { |
| 133 #if defined(ANDROID) |
| 134 LOG_PRI_VA(ANDROID_LOG_INFO, LOG_TAG, format, args); |
| 135 #else |
| 129 vprintf(format, args); | 136 vprintf(format, args); |
| 137 #endif |
| 130 } | 138 } |
| 131 | 139 |
| 132 | 140 |
| 133 void OS::PrintError(const char* format, ...) { | 141 void OS::PrintError(const char* format, ...) { |
| 134 va_list args; | 142 va_list args; |
| 135 va_start(args, format); | 143 va_start(args, format); |
| 136 VPrintError(format, args); | 144 VPrintError(format, args); |
| 137 va_end(args); | 145 va_end(args); |
| 138 } | 146 } |
| 139 | 147 |
| 140 | 148 |
| 141 void OS::VPrintError(const char* format, va_list args) { | 149 void OS::VPrintError(const char* format, va_list args) { |
| 150 #if defined(ANDROID) |
| 151 LOG_PRI_VA(ANDROID_LOG_ERROR, LOG_TAG, format, args); |
| 152 #else |
| 142 vfprintf(stderr, format, args); | 153 vfprintf(stderr, format, args); |
| 154 #endif |
| 143 } | 155 } |
| 144 | 156 |
| 145 | 157 |
| 146 int OS::SNPrintF(Vector<char> str, const char* format, ...) { | 158 int OS::SNPrintF(Vector<char> str, const char* format, ...) { |
| 147 va_list args; | 159 va_list args; |
| 148 va_start(args, format); | 160 va_start(args, format); |
| 149 int result = VSNPrintF(str, format, args); | 161 int result = VSNPrintF(str, format, args); |
| 150 va_end(args); | 162 va_end(args); |
| 151 return result; | 163 return result; |
| 152 } | 164 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 return ntohl(value); | 354 return ntohl(value); |
| 343 } | 355 } |
| 344 | 356 |
| 345 | 357 |
| 346 Socket* OS::CreateSocket() { | 358 Socket* OS::CreateSocket() { |
| 347 return new POSIXSocket(); | 359 return new POSIXSocket(); |
| 348 } | 360 } |
| 349 | 361 |
| 350 | 362 |
| 351 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| OLD | NEW |