Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/JsValue.cpp

Issue 29417605: Issue 5034 - Part 3: Create plain JsValue instead of JsValuePtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: FIxed JsContext bug and a few others. Created April 19, 2017, 9:55 p.m.
Right Patch Set: Pass JsEngine by ref Created April 20, 2017, 1:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/JsEngine.cpp ('k') | src/Notification.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 30 matching lines...) Expand all
41 : jsEngine(src.jsEngine) 41 : jsEngine(src.jsEngine)
42 { 42 {
43 const JsContext context(src.jsEngine); 43 const JsContext context(src.jsEngine);
44 value.reset(new v8::Persistent<v8::Value>(src.jsEngine->GetIsolate(), *src.val ue)); 44 value.reset(new v8::Persistent<v8::Value>(src.jsEngine->GetIsolate(), *src.val ue));
45 } 45 }
46 46
47 AdblockPlus::JsValue::~JsValue() 47 AdblockPlus::JsValue::~JsValue()
48 { 48 {
49 if (value) 49 if (value)
50 { 50 {
51 const JsContext context(jsEngine);
sergei 2017/04/20 07:42:52 I think it deserves a separate commit. Do you mind
hub 2017/04/20 12:41:01 will do.
52 value->Dispose(); 51 value->Dispose();
53 value.reset(); 52 value.reset();
54 } 53 }
55 } 54 }
56 55
57 JsValue& AdblockPlus::JsValue::operator=(const JsValue& src) 56 JsValue& AdblockPlus::JsValue::operator=(const JsValue& src)
58 { 57 {
59 const JsContext context(src.jsEngine); 58 const JsContext context(src.jsEngine);
60 if (value) 59 if (value)
61 value->Dispose(); 60 value->Dispose();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 const v8::TryCatch tryCatch; 261 const v8::TryCatch tryCatch;
263 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); 262 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue());
264 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), 263 v8::Local<v8::Value> result = func->Call(thisObj, args.size(),
265 args.size() ? &args[0] : nullptr); 264 args.size() ? &args[0] : nullptr);
266 265
267 if (tryCatch.HasCaught()) 266 if (tryCatch.HasCaught())
268 throw JsError(tryCatch.Exception(), tryCatch.Message()); 267 throw JsError(tryCatch.Exception(), tryCatch.Message());
269 268
270 return JsValue(jsEngine, result); 269 return JsValue(jsEngine, result);
271 } 270 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld