OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/gpu/gpu_benchmarking_extension.h" | 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return v8::Undefined(); | 217 return v8::Undefined(); |
218 | 218 |
219 WebView* web_view = web_frame->view(); | 219 WebView* web_view = web_frame->view(); |
220 if (!web_view) | 220 if (!web_view) |
221 return v8::Undefined(); | 221 return v8::Undefined(); |
222 | 222 |
223 WebViewBenchmarkSupport* benchmark_support = web_view->benchmarkSupport(); | 223 WebViewBenchmarkSupport* benchmark_support = web_view->benchmarkSupport(); |
224 if (!benchmark_support) | 224 if (!benchmark_support) |
225 return v8::Undefined(); | 225 return v8::Undefined(); |
226 | 226 |
227 FilePath dirpath; | 227 FilePath dirpath(FilePath::StringType(*dirname, |
228 dirpath = dirpath.AppendASCII(*dirname); | 228 *dirname + dirname.length())); |
229 if (!file_util::CreateDirectory(dirpath) || | 229 if (!file_util::CreateDirectory(dirpath) || |
230 !file_util::PathIsWritable(dirpath)) { | 230 !file_util::PathIsWritable(dirpath)) { |
231 std::string msg("Path is not writable: "); | 231 std::string msg("Path is not writable: "); |
232 msg.append(dirpath.MaybeAsASCII()); | 232 msg.append(dirpath.MaybeAsASCII()); |
233 return v8::ThrowException(v8::Exception::Error( | 233 return v8::ThrowException(v8::Exception::Error( |
234 v8::String::New(msg.c_str(), msg.length()))); | 234 v8::String::New(msg.c_str(), msg.length()))); |
235 } | 235 } |
236 | 236 |
237 SkPictureRecorder recorder(dirpath); | 237 SkPictureRecorder recorder(dirpath); |
238 benchmark_support->paint(&recorder, | 238 benchmark_support->paint(&recorder, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 return results.results_array(); | 313 return results.results_array(); |
314 } | 314 } |
315 }; | 315 }; |
316 | 316 |
317 v8::Extension* GpuBenchmarkingExtension::Get() { | 317 v8::Extension* GpuBenchmarkingExtension::Get() { |
318 return new GpuBenchmarkingWrapper(); | 318 return new GpuBenchmarkingWrapper(); |
319 } | 319 } |
320 | 320 |
321 } // namespace content | 321 } // namespace content |
OLD | NEW |