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 "chrome/renderer/extensions/chrome_private_custom_bindings.h" | 5 #include "chrome/renderer/extensions/chrome_private_custom_bindings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Note(mnaganov): to speed this up, you may use backing store | 93 // Note(mnaganov): to speed this up, you may use backing store |
94 // technique from CreateExternalArray() of v8/src/d8.cc. | 94 // technique from CreateExternalArray() of v8/src/d8.cc. |
95 v8::Local<v8::Array> bitmap_array(v8::Array::New(width * height)); | 95 v8::Local<v8::Array> bitmap_array(v8::Array::New(width * height)); |
96 for (int i = 0; i != width * height; ++i) { | 96 for (int i = 0; i != width * height; ++i) { |
97 bitmap_array->Set(v8::Integer::New(i), | 97 bitmap_array->Set(v8::Integer::New(i), |
98 v8::Integer::New(pixels[i] & 0xFFFFFF)); | 98 v8::Integer::New(pixels[i] & 0xFFFFFF)); |
99 } | 99 } |
100 return bitmap_array; | 100 return bitmap_array; |
101 } | 101 } |
102 | 102 |
103 v8::Handle<v8::FunctionTemplate> ChromePrivateCustomBindings::GetNativeFunction( | 103 void ChromePrivateCustomBindings::SetNativeFunctions( |
104 v8::Handle<v8::String> name) { | 104 v8::Handle<v8::Object> object) { |
105 if (name->Equals(v8::String::New("DecodeJPEG"))) | 105 RouteFunctionToStatic("DecodeJPEG", DecodeJPEG, object); |
106 return v8::FunctionTemplate::New(DecodeJPEG, v8::External::New(this)); | |
107 | |
108 return ChromeV8Extension::GetNativeFunction(name); | |
109 } | 106 } |
110 | 107 |
111 } // namespace extensions | 108 } // namespace extensions |
OLD | NEW |