| 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/pepper/v8_var_converter.h" | 5 #include "content/renderer/pepper/v8_var_converter.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 void FromV8ValueComplete(const ScopedPPVar& scoped_var, | 46 void FromV8ValueComplete(const ScopedPPVar& scoped_var, |
| 47 bool success) { | 47 bool success) { |
| 48 NOTREACHED(); | 48 NOTREACHED(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 class MockResourceConverter : public content::ResourceConverter { | 51 class MockResourceConverter : public content::ResourceConverter { |
| 52 public: | 52 public: |
| 53 virtual ~MockResourceConverter() {} | 53 ~MockResourceConverter() override {} |
| 54 virtual void Reset() override {} | 54 void Reset() override {} |
| 55 virtual bool NeedsFlush() override { return false; } | 55 bool NeedsFlush() override { return false; } |
| 56 virtual void Flush(const base::Callback<void(bool)>& callback) override { | 56 void Flush(const base::Callback<void(bool)>& callback) override { |
| 57 NOTREACHED(); | 57 NOTREACHED(); |
| 58 } | 58 } |
| 59 virtual bool FromV8Value(v8::Handle<v8::Object> val, | 59 bool FromV8Value(v8::Handle<v8::Object> val, |
| 60 v8::Handle<v8::Context> context, | 60 v8::Handle<v8::Context> context, |
| 61 PP_Var* result, | 61 PP_Var* result, |
| 62 bool* was_resource) override { | 62 bool* was_resource) override { |
| 63 *was_resource = false; | 63 *was_resource = false; |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 virtual bool ToV8Value(const PP_Var& var, | 66 bool ToV8Value(const PP_Var& var, |
| 67 v8::Handle<v8::Context> context, | 67 v8::Handle<v8::Context> context, |
| 68 v8::Handle<v8::Value>* result) override { | 68 v8::Handle<v8::Value>* result) override { |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 // Maps PP_Var IDs to the V8 value handle they correspond to. | 73 // Maps PP_Var IDs to the V8 value handle they correspond to. |
| 74 typedef base::hash_map<int64_t, v8::Handle<v8::Value> > VarHandleMap; | 74 typedef base::hash_map<int64_t, v8::Handle<v8::Value> > VarHandleMap; |
| 75 | 75 |
| 76 bool Equals(const PP_Var& var, | 76 bool Equals(const PP_Var& var, |
| 77 v8::Handle<v8::Value> val, | 77 v8::Handle<v8::Value> val, |
| 78 VarHandleMap* visited_ids) { | 78 VarHandleMap* visited_ids) { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 expected->SetWithStringKey("null", quux.get()); | 435 expected->SetWithStringKey("null", quux.get()); |
| 436 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); | 436 ScopedPPVar oops(ScopedPPVar::PassRef(), StringVar::StringToPPVar("oops")); |
| 437 expected->SetWithStringKey("undefined", oops.get()); | 437 expected->SetWithStringKey("undefined", oops.get()); |
| 438 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); | 438 ScopedPPVar release_expected(ScopedPPVar::PassRef(), expected->GetPPVar()); |
| 439 | 439 |
| 440 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); | 440 ASSERT_TRUE(TestEqual(release_expected.get(), release_actual.get(), true)); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace content | 444 } // namespace content |
| OLD | NEW |