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

Side by Side Diff: chrome/renderer/extensions/set_icon_natives.cc

Issue 107083006: More v8-API-related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
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/set_icon_natives.h" 5 #include "chrome/renderer/extensions/set_icon_natives.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 isolate->ThrowException( 73 isolate->ThrowException(
74 v8::Exception::Error(v8::String::NewFromUtf8(isolate, kNoMemory))); 74 v8::Exception::Error(v8::String::NewFromUtf8(isolate, kNoMemory)));
75 return false; 75 return false;
76 } 76 }
77 bitmap.eraseARGB(0, 0, 0, 0); 77 bitmap.eraseARGB(0, 0, 0, 0);
78 78
79 uint32_t* pixels = bitmap.getAddr32(0, 0); 79 uint32_t* pixels = bitmap.getAddr32(0, 0);
80 for (int t = 0; t < width*height; t++) { 80 for (int t = 0; t < width*height; t++) {
81 // |data| is RGBA, pixels is ARGB. 81 // |data| is RGBA, pixels is ARGB.
82 pixels[t] = SkPreMultiplyColor( 82 pixels[t] = SkPreMultiplyColor(
83 ((data->Get(v8::Integer::New(4*t + 3))->Int32Value() & 0xFF) << 24) | 83 ((data->Get(v8::Integer::New(isolate, 4*t + 3))->Int32Value() & 0xFF)
84 ((data->Get(v8::Integer::New(4*t + 0))->Int32Value() & 0xFF) << 16) | 84 << 24) |
85 ((data->Get(v8::Integer::New(4*t + 1))->Int32Value() & 0xFF) << 8) | 85 ((data->Get(v8::Integer::New(isolate, 4*t + 0))->Int32Value() & 0xFF)
86 ((data->Get(v8::Integer::New(4*t + 2))->Int32Value() & 0xFF) << 0)); 86 << 16) |
87 ((data->Get(v8::Integer::New(isolate, 4*t + 1))->Int32Value() & 0xFF)
88 << 8) |
89 ((data->Get(v8::Integer::New(isolate, 4*t + 2))->Int32Value() & 0xFF)
90 << 0));
87 } 91 }
88 92
89 // Construct the Value object. 93 // Construct the Value object.
90 IPC::Message bitmap_pickle; 94 IPC::Message bitmap_pickle;
91 IPC::WriteParam(&bitmap_pickle, bitmap); 95 IPC::WriteParam(&bitmap_pickle, bitmap);
92 *bitmap_value = base::BinaryValue::CreateWithCopiedBuffer( 96 *bitmap_value = base::BinaryValue::CreateWithCopiedBuffer(
93 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size()); 97 static_cast<const char*>(bitmap_pickle.data()), bitmap_pickle.size());
94 98
95 return true; 99 return true;
96 } 100 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 155
152 request_sender_->StartRequest(context(), 156 request_sender_->StartRequest(context(),
153 name, 157 name,
154 request_id, 158 request_id,
155 has_callback, 159 has_callback,
156 for_io_thread, 160 for_io_thread,
157 &list_value); 161 &list_value);
158 } 162 }
159 163
160 } // namespace extensions 164 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/runtime_custom_bindings.cc ('k') | chrome/renderer/extensions/webstore_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698