Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/platform/platform_impl.h" | 5 #include "sky/viewer/platform/platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/files/file_path.h" | |
| 11 #include "base/files/file_util.h" | |
| 12 #include "base/path_service.h" | |
| 10 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 11 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 12 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 14 #include "mojo/public/cpp/application/application_impl.h" | 17 #include "mojo/public/cpp/application/application_impl.h" |
| 15 #include "net/base/data_url.h" | 18 #include "net/base/data_url.h" |
| 16 #include "net/base/mime_util.h" | 19 #include "net/base/mime_util.h" |
| 17 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 18 #include "sky/engine/public/platform/WebConvertableToTraceFormat.h" | 21 #include "sky/engine/public/platform/WebConvertableToTraceFormat.h" |
| 19 #include "sky/viewer/platform/weburlloader_impl.h" | 22 #include "sky/viewer/platform/weburlloader_impl.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 void PlatformImpl::updateTraceEventDuration( | 231 void PlatformImpl::updateTraceEventDuration( |
| 229 const unsigned char* category_group_enabled, | 232 const unsigned char* category_group_enabled, |
| 230 const char* name, | 233 const char* name, |
| 231 TraceEventHandle handle) { | 234 TraceEventHandle handle) { |
| 232 base::debug::TraceEventHandle traceEventHandle; | 235 base::debug::TraceEventHandle traceEventHandle; |
| 233 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 236 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
| 234 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 237 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
| 235 category_group_enabled, name, traceEventHandle); | 238 category_group_enabled, name, traceEventHandle); |
| 236 } | 239 } |
| 237 | 240 |
| 241 blink::WebData PlatformImpl::loadResource(const char* name) | |
|
eseidel
2014/11/18 19:38:48
This is a hack for now. Eventually we may be able
| |
| 242 { | |
|
abarth-chromium
2014/11/18 22:37:37
Merge with previous line.
| |
| 243 base::FilePath root_dir; | |
| 244 PathService::Get(base::DIR_SOURCE_ROOT, &root_dir); | |
| 245 base::FilePath engine_dir = root_dir.AppendASCII("sky").AppendASCII("engine"); | |
| 246 base::FilePath v8_dir = engine_dir.AppendASCII("bindings").AppendASCII("core") .AppendASCII("v8"); | |
| 247 base::FilePath inspector_dir = engine_dir.AppendASCII("core").AppendASCII("ins pector"); | |
|
abarth-chromium
2014/11/18 22:37:37
Can you file a bug about this too? We won't have
| |
| 248 | |
| 249 base::FilePath path; | |
| 250 if (std::string("InjectedScriptSource.js") == name) | |
| 251 path = inspector_dir.AppendASCII(name); | |
| 252 else if (std::string("DebuggerScript.js") == name) | |
| 253 path = v8_dir.AppendASCII(name); | |
| 254 else | |
| 255 CHECK(false); | |
| 256 | |
| 257 std::string buffer; | |
| 258 base::ReadFileToString(path, &buffer); | |
| 259 CHECK(!buffer.empty()); | |
| 260 return blink::WebData(buffer.data(), buffer.size()); | |
| 261 } | |
| 262 | |
| 238 } // namespace sky | 263 } // namespace sky |
| OLD | NEW |