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

Side by Side Diff: tools/ipc_fuzzer/fuzzer/fuzzer.cc

Issue 2503203002: Revert "Getting rid of DelegatedFrameData" (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <iostream> 5 #include <iostream>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 static bool Fuzz(cc::CompositorFrame* p, Fuzzer* fuzzer) { 676 static bool Fuzz(cc::CompositorFrame* p, Fuzzer* fuzzer) {
677 // TODO(mbarbella): Support mutation. 677 // TODO(mbarbella): Support mutation.
678 if (!fuzzer->ShouldGenerate()) 678 if (!fuzzer->ShouldGenerate())
679 return true; 679 return true;
680 680
681 if (!FuzzParam(&p->metadata, fuzzer)) 681 if (!FuzzParam(&p->metadata, fuzzer))
682 return false; 682 return false;
683 683
684 switch (RandInRange(2)) { 684 switch (RandInRange(2)) {
685 case 0: { 685 case 0: {
686 if (!FuzzParam(&p->resource_list, fuzzer)) 686 p->delegated_frame_data.reset(new cc::DelegatedFrameData());
687 return false; 687 if (!FuzzParam(p->delegated_frame_data.get(), fuzzer))
688 if (!FuzzParam(&p->render_pass_list, fuzzer))
689 return false; 688 return false;
690 return true; 689 return true;
691 } 690 }
692 default: 691 default:
693 // Fuzz nothing to handle the no frame case. 692 // Fuzz nothing to handle the no frame case.
694 return true; 693 return true;
695 } 694 }
696 } 695 }
697 }; 696 };
698 697
698 template <>
699 struct FuzzTraits<cc::DelegatedFrameData> {
700 static bool Fuzz(cc::DelegatedFrameData* p, Fuzzer* fuzzer) {
701 if (!FuzzParam(&p->resource_list, fuzzer))
702 return false;
703 if (!FuzzParam(&p->render_pass_list, fuzzer))
704 return false;
705 return true;
706 }
707 };
708
699 template <class A> 709 template <class A>
700 struct FuzzTraits<cc::ListContainer<A>> { 710 struct FuzzTraits<cc::ListContainer<A>> {
701 static bool Fuzz(cc::ListContainer<A>* p, Fuzzer* fuzzer) { 711 static bool Fuzz(cc::ListContainer<A>* p, Fuzzer* fuzzer) {
702 // TODO(mbarbella): This should actually do something. 712 // TODO(mbarbella): This should actually do something.
703 return true; 713 return true;
704 } 714 }
705 }; 715 };
706 716
707 template <> 717 template <>
708 struct FuzzTraits<cc::QuadList> { 718 struct FuzzTraits<cc::QuadList> {
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" 2009 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h"
2000 #undef IPC_MESSAGE_DECL 2010 #undef IPC_MESSAGE_DECL
2001 #define IPC_MESSAGE_DECL(name, ...) \ 2011 #define IPC_MESSAGE_DECL(name, ...) \
2002 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; 2012 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz;
2003 2013
2004 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { 2014 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) {
2005 #include "tools/ipc_fuzzer/message_lib/all_messages.h" 2015 #include "tools/ipc_fuzzer/message_lib/all_messages.h"
2006 } 2016 }
2007 2017
2008 } // namespace ipc_fuzzer 2018 } // namespace ipc_fuzzer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698